escape unescape的php下的实现方法
2015-01-24信息快讯网
preg_match_all("/[\x80-\xff].|[\x01-\x7f]+/",$str,$r);
$ar = $r[0];
foreach($ar as $k=>$v) {
if(ord($v[0]) < 128)
$ar[$k] = rawurlencode($v);
else
$ar[$k] = "%u".bin2hex(iconv("GB2312","UCS-2",$v));
}
return join("",$ar);
}
function unescape($str) {
$str = rawurldecode($str);
preg_match_all("/(?:%u.{4})|.+/",$str,$r);
$ar = $r[0];
foreach($ar as $k=>$v) {
if(substr($v,0,2) == "%u" && strlen($v) == 6)
$ar[$k] = iconv("UCS-2","GB2312",pack("H4",substr($v,-4)));
}
return join("",$ar);
}
php pack与unpack 摸板字符字符含义
php面向对象全攻略 (六)__set() __get() __isset() __unset()的用法
PHP has encountered an Access Violation at 7C94BD02解决方法
PHP PDO函数库(PDO Functions)第1/2页
php ignore_user_abort与register_shutdown_function 使用方法
php escape URL编码
解决php中Cannot send session cache limiter 的问题的方法
mysql 全文搜索 技巧
PHP has encountered an Access Violation
function.inc.php超越php
弄了个检测传输的参数是否为数字的Function
怎样在UNIX系统下安装php3
怎样在UNIX系统下安装MySQL