标题: 写PHP求助
时间: 2014-11-19
<?php
header("Content-type:text/html;charset=utf-8");
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
$msg=trim($_GET["msg"]);
$txt=file('texta.dat');
$sss=count($txt);//得到词库条数
for($x=0;$x<=$sss;$x++)
{
$content=explode('|',$txt[$x]);
$wen=$content[0];//获取问题
//“echo $content[1];“这个放在这里的话却能显示
if(preg_match("/{$wen}/",$msg))
{
echo $content[1];
exit;
}
}
$xh=file_get_contents("xiaohua.txt");
$xiao=explode('|',$xh);
$xh=count($xiao);
$xh=rand( 0 ,$xh);//随机笑话数值
$xiaohua=$xiao[$xh];
$nr="/lh{$nc}已经累得回答不了
请先看笑话轻松一下~
{$xiaohua}";
echo $nr;
?>
『回复列表(24|隐藏机器人聊天)』