小群纪

lxqun's blog

Subscribe to RSS feed

php代码自动缩进 phpstylist

http://sourceforge.net/projects/phpstylist

集成进 pspad.

自动 php 代码缩进 .
可在 php 命令行下,批量执行 .

参观 世纪公园中的梅园

一个不会生活,不懂情趣的人。
去这种地方。
幸亏是与一个女孩去 的。
她还比我会拍照,呵呵。



我的凡客版照片--好久没更新 my.opera


-----

-----

今天得知久封的my.opera.com 解封.特占一帖,以祝

今天得知久封的my.opera.com 解封.特占一帖,以祝

js 取 cookie 的中文乱码

js 取 cookie 的中文乱码
php 写 cookie

$username="小群";
$username=mb_convert_encoding($username,"UTF-8","GB2312");  //因为 此文件为ascii 编码
//$username=iconv("GB2312","UTF-8",$username);

$username=urlencode($username);  //这个 函数出来的 结果 与 js cookie 

setcookie('testname',$username,time()+3600);


js 取cookie
//document.write( document.cookie);
document.writeln(decodeURI("<?= $username ?>")) ;

document.writeln(GetCookie("testname")) ;

function GetCookie(cookieName){
    var cookieString = document.cookie;
    //return cookieString;
    var start = cookieString.indexOf(cookieName + '=');
    if (start == -1) 
	    return null;
    start += cookieName.length + 1;
    var end = cookieString.indexOf(";", start);
    if (end == -1) 
    return decodeURI(cookieString.substring(start));
    //return unescape(cookieString.substring(start));
    
    return decodeURI(cookieString.substring(start, end));
    //return unescape(cookieString.substring(start, end));
}


因为我们php写cookie 直接 是原来的 string,未加 urlencode 这类函数.
js 取 cookie 时发现 与 urlencode(string) 后的 结果 相同.

所以 在 js 中 改 unescape 为 decodeURI

js 取cookie 好像也只认 utf8 编码的.所以
php写cookie之前 要 转为utf8

硬盘空间配额 file system quota

, , ,

硬盘空间配额 file system quota
我们的server 出了问题, 除了root 用户,可以正常上传文件 ,其它 用户, 包括 apache 都不可以 正常写入文件.写任何文件 都是 0 字节.

好多天来, 重装 apache php mysql ,可以暂时解决 问题,但没过多久问题还是 出来了.
一开始 重装 后 可以用上几天, 现在装完就没用.

这样一天 就过去 也没找到问题.

今天 用某用户 vi 写一文件 报错了
 E514: write error (file system full?)

找到 一篇 说
...turns out I went over my quota on the server...
kevin 说空间配额 问题?

df 查一下

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              2016016   1937348         0 100% /
none                   1037212         0   1037212   0% /dev/shm
/dev/sda5             70880216   1750920  65528732   3% /usr
/dev/sda3              2016044    163708   1749924   9% /var



my god. 我们的网站放在 /home 下的.空间全用光了.
文件 当然写不进去了.



perl 正则表达式 去除中文

[^_0-9a-zA-Z\-.=+\(\),;'"`<>\[\]\$ ]



在 js 中 可用
[^\x00-\xFF]

linux 下的 apache + mysql + php

主要是 php
./configure --with-apxs2=/home/webadm/bin/apxs --disable-debug --with-mysql=/home/mysql5 --enable-so --with-libxml-dir=/home/libxml --enable-mbstring --with-gd --with-zlib --with-png --with-jpeg --with-xsl=/home/libxslt/lib


----------
xsl libxslt 的加载php5 为
--with-xsl=/home/libxslt/lib
不是
--with-libxsl-dir=/

还头一次在我的电脑上杀毒

现在的病毒 确实不是我所解决得了。有太多的文件 被感染。
而且我又不可以狠下心,把这些全删除掉。
卡巴斯基 试用,可以。
几乎全部的 exe 文件都被感染
viking.kl

电脑真是减寿啊。

安装pear

pear安装

unix:
运行
lynx -source http://go-pear.org | php
这实际上就是用lynx得到这个脚本并用管道传递给php程序以shell脚本的方式运行安装。

windows

打开这个
http://go-pear.org/
将 脚本 存为 pear_install.php

用dos 运行

php.exe pear_install.php

若有路径问题,无法在cmd 下 启动 , 我是在php目录下 建一 bat 文件 内容为
cmd.exe

pear_install.php中有一行
$pfc_packages

这个数组指定 需安装某些 pear 包

执行安装

最后 在 php.ini 中加上 pear 的路径


===================
资源:
pear的网站 http://pear.php.net/
PEAR简介:用PEAR来写你的下一个php程序 http://www-900.ibm.com/developerWorks/cn/linux/sdk/php/pear1/index.shtml
PEAR:常用模块 http://www-900.ibm.com/developerWorks/cn/linux/sdk/php/pear2/index.shtml
PEAR实践:PHP中MVC机制的实现 http://www-900.ibm.com/developerWorks/cn/linux/sdk/php/pear5/index.shtml
PEAR:使用PHPDoc轻松建立你的PEAR文档 http://www-900.ibm.com/developerWorks/cn/linux/sdk/php/pear3/index.shtml
PEAR:创建中间的数据库应用层 http://www-900.ibm.com/developerWorks/cn/linux/sdk/php/pear4/index.shtml