이 줄의 오류 : $an = explode(";", $f[$i]);
이 하나도 : if ($wasone)
(정의되지 않은 변수) 도움이 되셨습니까? 고맙습니다.정의되지 않은 오프셋 : 9, 정의되지 않은 변수
<?
if ($_POST["submit"])
{
$a = answer();
$out = "Q: $ask<br>A: ".$a;
$tile = ($cfg["scrolling"]) ? $tile : "";
echo "$out<br>$tile";
echo "<input name='tile' type='hidden' id='tile' value='$out<br>$tile'>";
}
// answers
function answer()
{
global $cfg, $ask;
$ask = (empty($ask)) ? "<empty>" : $ask;
$kick = array("?","\n");
$ask = str_replace($kick,"",$ask);
$f = file($cfg["answersfile"]);
for ($i=0; $i<=count($f); $i++)
{
$an = explode(";", $f[$i]);
$a = $an[0];
if (strstr($a,trim($ask)))
{
if ($wasone)
{
return("Please be more concrete");
}
array_shift($an);
array_pop($an);
$ai = rand(0, count($an)-1);
// answering
$wasone = true;
$retval = $an[$ai];
}
}
$retval = (empty($retval)) ? "I dont understand you. Please try again." : $retval;
return $retval;
}
?>
크리스티나, 내 의견을 msonsona의 대답을 참조하십시오. 그것은 미래의 PHP 스크립트 디자인에 대한 통찰력을 증명할 수 있습니다. – Blake