|
本帖最后由 ralf07 于 2009-7-21 16:18 编辑
class Homepage extends Controller {
function Homepage()
{
parent::Controller();
$this->load->model('News_model');
}
//首页
function index(){
//资讯头条
$data['headline']=$this->News_model->getNewsList(1,4);
//print_r($data['headline']);
$this->load->view('index',$data);
}
}
传到index.php的$headline->result()的结果如下:
Array ( [0] => stdClass Object ( [newsid] => 2 [sortid] => 1 [title] => 按时打发 [content] => 阿萨德 [times] => 111111111 [status] => 1 [label] => 1 [remark] => 1 ) [1] => stdClass Object ( [newsid] => 1 [sortid] => 1 [title] => 阿萨德 [content] => 阿萨德 [times] => 1111111 [status] => 1 [label] => 1 [remark] => 1 ) )
请问怎样可以数组逐个地取出来而不是遍历循环的?
例如:[0]['title']或者[1]['content'] |
|