Notice: Undefined variable: comments in D:\phpStudy\WWW\MySQLi2\mysqli\imoocComment\index.php on line 23 Warning: Invalid argument supplied for foreach() in D:\phpStudy\WWW\MySQLi2\mysqli\imoocComment\index.php on line 23 ???要炸了 看不懂了
加上这个if就可以了
if(!empty($comments)){
foreach($comments as $val){
echo $val->output();
}
}
有个变量未定义,提示在 foreach() 函数中那个变量是无效的,说是在 23 行,你仔细看看呗