wx.php

<?php
header('Content-type:text/json');
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Methods:POST');
header('Access-Control-Allow-Headers:x-requested-with,content-type');
function genRandmString($len,$arrs) {

/*A:z90048 B: gcdj023 C: gcdj0058 D:jcdj0093 E: gcdj0054 */
$chars = $arrs;
$charsLens = count($chars)-1;
$output= "";
shuffle($chars);
for($i = 0 ; $i < $len ; $i++) {
$output .=$chars[mt_rand(0,$charsLens)];
}
return $output;
}

 

function Redtxt($file) {
$buffer = 1024;
$str = "";
if(file_exists($file)) {
$hand = fopen($file,"r");
while(!feof($hand)) {

$str .=fread($hand,$buffer);
}
//$str = str_replace("\r\n","<br />",$str);
return explode("\r\n",trim($str));
fclose($hand);
}else {
echo "不存在文件";
exit();
}
}

$file_url = 'v.txt';
$arr_s = Redtxt($file_url);

$str = genRandmString(1,$arr_s);
//$json='({"wx":"'.$str.'","qq":"12323"})';
$json='{"wx":"'.$str.'"}';
echo $json;
exit();
?>

posted @ 2022-07-29 15:40  被水遗忘の鱼  阅读(18)  评论(0编辑  收藏  举报