新手,4096问题要怎么解决?
这是错误信息:A PHP Error was encounteredSeverity: 4096
Message: Object of class stdClass could not be converted to string
Filename: libraries/Table.php
Line Number: 269
代码:
控制器
function listing()
{
$this->load->library('table');
$this->load->model('blogmodel','',TRUE);
$students_qry = $this->blogmodel->listStudents();
// generate HTML table from query results
$students_table = $this->table->generate($students_qry);
// display information for the view
$data['title'] = "Classroom: Student Listing";
$data['headline'] = "Student Listing";
$data['include'] = 'student_listing';
$data['data_table'] = $students_table;
$this->load->view('blog_view', $data);
}
模型:function listStudents() {
$query=$this->db->get('demo');
return $query->result();
}
视图:<?php echo $data_table; ?> 269 行是什么内容? var_dump($students_qry);
看输出的是什么 就几十行程序,269行可能是帮助文件里面的 var_dump($student_qry)输出:array(5) { => object(stdClass)#15 (3) { ["id"]=> string(1) "1" ["title"]=> string(6) "title1" ["content"]=> string(8) "content1" } => object(stdClass)#16 (3) { ["id"]=> string(1) "2" ["title"]=> string(6) "title2" ["content"]=> string(10) "content2 " } => object(stdClass)#17 (3) { ["id"]=> string(1) "3" ["title"]=> string(6) "title3" ["content"]=> string(10) "content3 " } => object(stdClass)#18 (3) { ["id"]=> string(1) "4" ["title"]=> string(6) "title4" ["content"]=> string(10) "content4 " } => object(stdClass)#19 (3) { ["id"]=> string(1) "5" ["title"]=> string(6) "title5" ["content"]=> string(10) "content5 " } } 毫无疑问楼主是没按照手册的方法使用 Table 类库。
希望楼主好好看看手册。
页:
[1]