CharInt.php - 将数字转换为可排序字符串 <?php // 试验性脚本,请勿用于正式场合! // Experimental function, DO NOT use in formal occasions! function charint_encode($var){ return preg_replace_callback('/\d+/',function($row){ return (strlen($row['0'])>14)?$row['0']:sprintf('<%\'_9s>',base_convert($row['0'],10,36)); },htmlspecialchars($var)); } function charint_decode($var){ return htmlspecialchars_decode(preg_replace_callback('/\<(.*?)\>/',function($row){ return base_convert($row['1'],36,10); },$var)); } echo "<meta charset=\"UTF-8\"><br />\r\n"; echo charint_encode('Fuck16abcFuck<Fuck>Fuck699999999999999Fuck99999999999999'); echo "<br />\r\n"; echo charint_decode('Fuck<________g>abcFuck&lt;Fuck&gt;Fuck699999999999999Fuck<zg3d62r5r>'); die; ?>