标签:
//随机生成指定长度的字符串,一般用于验证码
function RandomCheckValid($len) {
$srcstr = "1a2s3d4f5g6hj8k9qwertyupzxcvbnm";
mt_srand();
$strs = "";
for ($i = 0; $i < $len; $i++) {
$strs .= $srcstr[mt_rand(0, 30)];
}
return $strs;
}
//此函数应该还不够全面
function SafeJson($varin)
{
$varout=str_replace("‘","“",$varin);
$varout=str_replace("\\","“",$varout);
$varout=str_replace("\n","",$varout);
$varout=str_replace("\r","",$varout);
return $varout;
}
标签:
原文地址:http://www.cnblogs.com/xiaochu/p/4607001.html