UTF-8:
<?php
function genstr($num)
{
for($i=0;$i<=$num;$i++)
{
$str .= '&#'.rand(19968, 40869).';';
}
return mb_convert_encoding($str, "UTF-8", "HTML-ENTITIES");
}
echo genstr(mt_rand(1,8));
?>
GBK:
<?php
function genstr($num)
{
for($i=0;$i<=$num;$i++)
{
$str .= chr(rand(0xB0,0xF7)).chr(rand(0xA1,0xFE));
}
return $str;
}
echo genstr(mt_rand(1,8));
?>
标签:none