【发布时间】:2015-02-14 00:09:34
【问题描述】:
我正在尝试从下面的数组中提取用户 ID,但我收到了这条消息:
A PHP Error was encountered
Severity: Notice
Message: Undefined index: profile_picture
Filename: views/profile_view.php
Line Number: 52
数组:
array (size=1)
'profile_picture' =>
array (size=1)
0 =>
object(stdClass)[21]
public 'UserID' => string '43' (length=2)
public 'PictProfFlag' => string '1' (length=1)
public 'PictPath' => string 'http://cms/uploads/category_icon.png' (length=36)
我是这样打印的:
foreach($profile_picture as $row)
{
echo $row->UserID;
}
我正在使用 Codeigniter 框架。
请帮忙
【问题讨论】:
-
你确定不是这样的:
foreach($array['profile_picture'] as $row) {? -
你能解释一下什么是 $profile_picture 吗?
-
你能在进入循环之前显示代码吗?
标签: php arrays codeigniter