2019年2月

1SQL运算符例子实际查询条件
eq=$map['id'] = array('eq',100);等效于:$map['id'] = 100;
neq!=$map['id'] = array('neq',100);id != 100
gt>$map['id'] = array('gt',100);id > 100
egt>=$map['id'] = array('egt',100);id >= 100
lt<$map['id'] = array('lt',100);id < 100
elt<=$map['id'] = array('elt',100);id <= 100
likelike$map['username'] = array('like','li%');username like 'li%'
betweenbetween and$map['id'] = array('between','1,8');id BETWEEN 1 AND 8
not betweennot between and$map['id'] = array('not between','1,8');id NOT BETWEEN 1 AND 8
inin$map['id'] = array('in','1,5,8');id in(1,5,8)
not innot in$map['id'] = array('not in','1,5,8');id not in(1,5,8)
and(默认)and$map['id'] = array(array('gt',1),array('lt',10));(id > 1) AND (id < 10)
oror$map['id'] = array(array('gt',3),array('lt',10), 'or');(id > 3) OR (id < 10)
xor(异或)xor两个输入中只有一个是true时,结果为true,否则为false,例子略。1 xor 1 = 0
exp综合表达式$map['id'] = array('exp','in(1,3,8)');$map['id'] = array('in','1,3,8');

注意:exp 不是一个运算符,而是一个综合表达式以支持更复杂的条件设置。exp 的操作条件不会被当成字符串,可以使用任何 SQL 支持的语法,包括使用函数和字段名称。

php自带函数file_exists判断文件是否存在,is_dir判断文件夹是否存在

如:

//当/www/index.php 都实际存在时
$file='index.php';
$dir='/www/';
if(file_exists($dir.$file)){
    echo '文件'.$file.'存在';
}else{
    echo '文件'.$file.'不存在';
}
if(is_dir($dir)){
    echo '目录'.$dir.'存在';
}else{
    echo '目录'.$dir.'不存在';
}

nginx配置

server {
    listen 80;
    server_name xx.com www.xx.com;
    index  index.html index.htm index.php;
    #access_log /var/log/nginx/xx.a.log;
    #error_log /var/log/nginx/xx.e.log;

    location ~ .*\.php(\/.*)*$ {
        root           /apps/www/bolg;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location / {
        root /apps/www/bolg;
        index index.php;
        if (-f $request_filename/index.html){
            rewrite (.*) $1/index.html break;
        }
        if (-f $request_filename/index.php){
            rewrite (.*) $1/index.php;
        }
        if (!-f $request_filename){
            rewrite (.*) /index.php;
        }
        if ($request_uri = / ){
            rewrite (.*) /index.php;
        }
    }

    location = / {
        rewrite (.*) /index.php;
    }

}