模仿csdn的代码,己整理的Linux常用命令(3)
} }
[代码] [PHP]代码 /**
* c远程传输工具 */
public function post_c($,$body,$header,$type='POST'){ $ch = c_init();
c_setopt($ch,COPT_,$);
c_setopt($ch,COPT_HEADER,0);//0只要正文 c_setopt($ch,COPT_TIMEOUT,5);//设置超时时间 c_setopt($ch,COPT_CONNECTTIMEOUT,5);
//将c_exec()获取的信息以文件流的形式返回,而不是直接输出。 c_setopt($ch,COPT_RETURNTRANSFER,1); //增加header头信息
// array_push($header,'Accept:application/json');
// array_push($header,'Content-Type:application/json'); // array_push($header,'http:multipart/form-data'); if(count($body)>0){
c_setopt($ch,COPT_POSTFIELDS,$body); }
if(count($header)>0){
c_setopt($ch,COPT_HTTPHEADER,$header); }
//设置上传文件相关
c_setopt($ch,COPT_FOLLOWLOCATION,true); c_setopt($ch,COPT_MAXREDIRS,3);//递归
c_setopt($ch,COPT_SSL_VERIFYPEER,false);// 对认证证书来源的检查 c_setopt($ch,COPT_SSL_VERIFYHOST,0);// 从证书中检查SSL加密算法 switch ($type) { case 'GET':
c_setopt($ch,COPT_HTTPGET,1); break; case 'POST':
c_setopt($ch,COPT_POST,1); break; case 'PUT':
c_setopt($ch,COPT_CUSTOMREQUEST,'PUT'); break; case 'DELETE':
c_setopt($ch,COPT_CUSTOMREQUEST,'DELETE'); break; }
//上传文件相关设置
c_setopt($ch,COPT_ENCODING,'gzip');
c_setopt($ch,COPT_USERAGENT,'SSTS Browser/1.0'); c_setopt($ch,COPT_USERAGENT,'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)');// 模拟用户使用的浏览器 if(c_errno($ch)){
return c_error($ch); }
$content = c_exec($ch);
c_close($ch);//关闭c资源,并且释放系统资源 $result = json_decode($content,true); if(!empty($result)){ return $result; }else{
return $content; } }
[代码] [C/C++]代码 /*
编译指令
$ /opt/sybase/OCS-16_0/bin/cpre64 -m teststu.cp
$ cc -m64 -g -DSYB_LP64 -I. -I/opt/sybase/OCS-16_0/include teststu.c
/opt/sybase/OCS-16_0/include/sybesql.c -L/opt/sybase/OCS-16_0/lib -lsybct64 -lsybtcl64 -lsybcs64 -lsybcomn64 -lsybintl64 -lsybunic64 -rdynamic -ldl -lnsl -lm -o teststu */
#include
www.jat.cn 小型臭氧发生器 侳侱侲 /*建立通讯区域*/
EXEC SQL INCLUDE SQLCA; /*
** These tokens must be declared in a declare section ** because they are used in declare sections below. */
EXEC SQL BEGIN DECLARE SECTION; #define TYPESIZE 13 #define TIDSIZE 6
EXEC SQL END DECLARE SECTION;
#define EOLN '\\0' /*
** Forward declarations of the error and message handlers and ** other subroutines called from main(). */
void error_handler();
void warning_handler(); int
main(int argc, char *argv[]) {
/*声明宿主变量*/
EXEC SQL BEGIN DECLARE SECTION;
/* storage for login name and password. */ char username[30]; char sname[30]; char password[30]; char server[30];
EXEC SQL END DECLARE SECTION; /*错误处理*/
EXEC SQL WHENEVER SQLERROR CALL error_handler(); EXEC SQL WHENEVER SQLWARNING CALL warning_handler(); EXEC SQL WHENEVER NOT FOUND CONTINUE; /*连接到 SQL SERVER 服务器*/
/*
** Copy the user name and password defined in sybsqlex.h to ** the variables declared for them in the declare section. */
strcpy(username, \ strcpy(password, \
strcpy(server, \
EXEC SQL CONNECT :username IDENTIFIED BY :password using :server;
EXEC SQL USE testdb;
EXEC SQL DECLARE c1 CURSOR FOR SELECT SNAME FROM STUDENT; EXEC SQL OPEN c1;
printf(\ do {
EXEC SQL FETCH c1 INTO :sname; if (sqlca.sqlcode != 0) break;
printf( \ } while ( 1 ); EXEC SQL CLOSE c1;
return(0); }
/*错误处理程序*/ /*
** void error_handler() **
** Displays error codes and numbers from the SQLCA and exits with ** an ERREXIT status. */ void
error_handler(void) {
fprintf(stderr, \
if (sqlca.sqlerrm.sqlerrml) {
fprintf(stderr, \
fprintf(stderr, \ }
fprintf(stderr, \
exit(-1); } /*
** void warning_handler() **
** Displays warning messages. */ void
warning_handler(void) {
if (sqlca.sqlwarn[1] == 'W') {
fprintf(stderr, \ }
if (sqlca.sqlwarn[3] == 'W') {
fprintf(stderr,
\ } return;
}
[代码] Log4j配置
slf4j-log4j12
导入这个包,会引入下面两个jar
spring-context-support
commons-logging-api
aspectjweaver
[文件] 无缝滚动.html ~ 1KB
