我有一个名为我的categories
控制器
function description($id=null) {
$this->load->helper(array('form', 'url'));
$this->load->library('session');
$this->load->view('category/description');
$this->load->model('userdata_model');
$data = $this->userdata_model->desc($id);
$this->load->view('category/description', $data);
}
现在,当我这样做时,print_r($data);
它会给我以下结果
Array
(
[0] => stdClass Object
(
[id] => 4481
[title] => Dvd Recorder Post
[image_name] =>
[image_name_work] =>
[video_name] =>
[work_type] => tape-recrder
[description] => Test first..
[agency] =>
[services] =>
[photographer] =>
[company] =>
[director] =>
[dop] =>
[userid] =>
[display_order] => 99999
[latest_work] => No
[status] => Active
[post_adddate] => 2012-03-26 10:14:07
[date] => 2012-03-26 10:14:07
[sub_cat] => dvd-reorder
[views] => 75
[url] => Dvd-recorder-post
[post_cache] =>
[post_cat_id] => 0
[post_link] =>
[post_pubdate] =>
[post_seo_url] =>
[post_status] => 0
[post_type] => 0
)
)
现在,当我尝试在视图页面中访问$data
时description.php
,它给了我以下错误
A PHP Error was encountered Severity: Notice Message: Undefined variable: data Filename: category/description.php Line Number: 2
有人知道为什么吗?