我試圖通過數據來查看,但它給了我這個錯誤: 未定義的變量:數據將數據傳遞到瀏覽笨
控制器:
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-索引) –