分类 代码分析 下的文章

让Nginx支持SCRIPT_URL

由于访问增加,将服务器由apache转换到了nginx。
由于框架底层里用到了SCRIPT_URL,需要配置nginx支持这个参数。

特记录配置:

server {
                listen 80;
                server_name test.com;

                root /data/www;

                location / {
                  index index.php;
                }

                if ( $fastcgi_script_name ~ \..*\/.*php ) {
                        return 403;
                }

                # if the request file name contains one of the below extensions,
                # serve it directly
                if ($request_filename ~* \.(js|ico|gif|jpg|png|css|xml|php|txt)$) {
                  break;
                }

                # otherwise, /index.php handles the request
                rewrite ^(.*)$ /index.php$1 last;

                location ~ ^(?P.+\.php)(?P.*)$ {
                  include fastcgi_params;
                  fastcgi_param PATH_INFO $PATH_INFO;
                  fastcgi_param DOCUMENT_ROOT /data/www;
                  fastcgi_param PATH_TRANSLATED $document_root$PATH_INFO;
                  fastcgi_param SCRIPT_FILENAME $document_root$SCRIPT_FILENAME;

                  fastcgi_index index.php;
                  fastcgi_param RUN_MODE production;

                  # Attention!  Both PHP_SELF and SCRIPT_NAME must contain the same value,
                  # but they don't!
                  fastcgi_param PHP_SELF $uri;
                  fastcgi_param SCRIPT_NAME $uri;

                  # set SCRIPT_URL/SCRIPT_URI for compatibility
                  fastcgi_param SCRIPT_URL $PATH_INFO;
                  fastcgi_param SCRIPT_URI $scheme://$http_host$PATH_INFO;

                  fastcgi_param PHP_VALUE "include_path=$document_root:$document_root/include";

                  try_files $SCRIPT_FILENAME =404;
                  fastcgi_pass  unix:/tmp/php-fcgi-faq.sock;
                }
}

svn: warning: cannot set LC_CTYPE locale

svn: warning: cannot set LC_CTYPE locale
svn: warning: environment variable LANG is en
svn: warning: please check that your locale name is correct
svn: Can't convert string from 'UTF-8' to native encoding:

解决方法:

vim ~/.profile

添加如下代码:
export LANG="zh_CN.UTF-8"
export LC_ALL="zh_CN.UTF-8"

Linux下创建用户命令

1.创建用户:

/usr/sbin/useradd -d /data/home/don -m -G users don

将其中的don改为你需要的用户名即可。

2.设置密码:

passwd don

输入两次密码即可。

以上命令都需要在root下执行。

jQuery使用attr判断选中状态返回一直为undefined的问题

jQuery增加全选功能,代码如下:

console.log(jq('#b').attr('checked'));
if (jq('#b').attr('checked')) {
    jq('input[name="a[]"]').attr('checked', true);
} else {
    jq('input[name="a[]"]').attr('checked', false);
}

控制台一直输出的是undefined.

百度一番后才知道是版本问题:

Jquery1.6增加了prop方法,但是一直没有用,前段时间项目升级了Jquery1.7以后,需要对checked,disabled等获取时,使用prop方法,对于普通的属性则还是使用attr http://api.jquery.com/attr/ attr属性介绍中Description章节的最后就有介绍相关信息的用法

地址:http://www.oschina.net/question/163066_118826