我试图通过数据来查看,但它给了我这个错误: 未定义的变量:数据将数据传递到浏览笨
控制器:
public function article($page=1)
{
$info = array(
"module_name" => $this->module_name,
"view_name" => "cms/cms_view", // your view path
"error_msg" => "",
"error_type" => "",
"data" => array(
'content'=>$this->cms_model->get_cms($page),
'test'=>'Hello world'
), //data which will be sent to view
);
$this->loadview->view($info);
}
型号:
public function get_cms($page)
{
$query = $this->db->get_where('article', array('art_id' => $page),1);
return $query->row();
}
查看:
<?php
echo $data->content;
?>
[PHP:“Notice:Undefined variable”和“Notice:Undefined index”]的可能重复(http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-索引) –