Php 要使用索引..显示数据吗。。?
我正在研究codeigniter。我想显示从后端到视图文件的数据。这是我的密码Php 要使用索引..显示数据吗。。?,php,javascript,html,Php,Javascript,Html,我正在研究codeigniter。我想显示从后端到视图文件的数据。这是我的密码 $result = $obj->get_details(); if ($result[0]) { for ($i=0; $i<count($result); $i++) { echo $result [$i]['name']; } } $result=$obj->get_details(); 如果($res
$result = $obj->get_details();
if ($result[0])
{
for ($i=0; $i<count($result); $i++) {
echo $result [$i]['name'];
}
}
$result=$obj->get_details();
如果($result[0])
{
对于($i=0;$i请尝试
for ($i=0; $i<count($result); $i++) {
echo $result[$i]->name;
}
用于($i=0;$iname;
}
因为$result[$i]
是一个包含名称
值的对象,请尝试此操作
echo $result [$i]->name;
而不是
echo $result [$i]['name'];