【发布时间】:2009-11-12 07:28:51
【问题描述】:
收到警告:第 41 行 /home/maxer/domains/x/public_html/x/items.php 中为 foreach() 提供的参数无效
第 41 行是 foreach
$items = getUserList($user,0,100);
foreach($items as $item){
echo "<img src=\"".$item['image']."\">"; //image
echo ""; //title
echo ""; //button for add to list
}
【问题讨论】:
-
vardump($items)说什么? -
顺便说一句,在编写一个可能返回数组的函数时,最好做的一件事是,如果没有找到任何项,则让它返回一个空数组。这样,您就永远不会遇到此错误。
-
我切换到这种方法以及投射
标签: php