1. //获取域名或主机地址
echo $_SERVER['HTTP_HOST']."
";
//获取网页地址
echo $_SERVER['PHP_SELF']."
";
//获取网址参数
echo $_SERVER["QUERY_STRING"]."
";
//来源网页的详细地址
echo $_SERVER['HTTP_REFERER']."
";
?>
2.生成随机数
function random($length) {
$hash = "@#@#";
$chars = "@#ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz@#";
$max = strlen($chars) - 1;
mt_srand((double)microtime()*100000000);
for($i=0;$i<$length;$i++) {
$hash.=$chars[mt_rand(0,$max)];
}
return $hash;
}
echo random(10)."
";
阅读(1439) | 评论(0) | 转发(0) |