我正在学习CodeIgniter 3,并因为我做的(可能)愚蠢的事情而停下来。你能帮我在我的代码中找出问题吗?CodeIgniter查询在视图 - 数组到字符串错误
我试图从数据库中显示的一些数据行,我得到这个错误
A PHP Error was encountered Severity: Notice Message: Array to string conversion Filename: core/MY_Controller.php Line Number: 24 Backtrace:
File: /public_html/siiga/application/core/MY_Controller.php Line: 24 Function: _error_handler
File: /public_html/siiga/application/core/MY_Controller.php Line: 45 Function: render
File: /public_html/siiga/application/controllers/admin/Docs.php Line: 74 Function: render
File: /public_html/siiga/index.php Line: 315 Function: require_once
我的控制器
public function existing() // Recieved, Unsolved
{
$this->load->database();
$this->load->model('Docs_model');
$this->load->library('table');
$data['query'] = $this->Docs_model->viewexisting();
$this->render('admin/docs/existing_view', $data);
}
我的模型
public function viewexisting()
{
$query = $this->db->query("SELECT * FROM docs");
return $query->result();
}
我查看
<?php foreach($query as $row){?>
<table>
<tr>
<td><?php echo $row->numar_inreg ;?></td>
<td><?php echo $row->nume_doc ;?></td>
<?php }?>
什么是'行号:24'? –
'code' 一个PHP错误遇到 严重性:注意 消息:数组字符串转换 文件名:核心/ MY_Controller.php 行号:24 回溯: 文件:/ *** * 1 /的public_html/siiga /应用/核心/ MY_Controller.php 线:24 功能:_error_handler 文件:/****/public_html/siiga/application/core/MY_Controller.php 线:45 功能:渲染 文件:*** /的public_html/siiga /应用/控制器/管理/ Docs.php 线:74 功能:渲染 文件:****的public_html/siiga/index.php的 线:315 功能:require_once 'code'这是完整的错误。 –
'$ template'是什么?它是一个数组? –