我正在努力掌握编码器。虽然我认为一切都应该工作,我得到以下错误Unable to load the requested file: helpers/database_helper.php
在helpers文件夹中只有index.html文件,在libraries中也只有index.html文件。我在这里错过了什么,我已经从官方代码点火器网站下载了包。
显然ci找不到帮助文件,我已显式加载为
class mydb_model extends CI_Model {
public function getAll(){
$this->load->helper('database');
$q = $this->db->get('Test', 'desc');
if ($q->num_rows() >0) {
foreach ($q->result() as $row){
$data[] = $row;
}
return $data;
}
}
有什么问题吗?
如果要加载数据库,请使用:
$this->load->database();
您需要退出应用程序文件夹并进入系统文件夹,然后进入助手文件夹以查看codeigniter helper。有两个"helper"文件夹
但是,你可以进入application->config,打开autolload .php,然后把你想要加载的东西放在那里。
旁注:helper基本上就是可以全局调用的php函数