我正在尝试测试(学习)codeigniter的示例代码,但当我运行我的项目时,我遇到了这样的错误http://localhost/CodeIgniter_test/todos从而发生跟随错误
遇到错误
无法加载请求的文件:templates/header.php
我从这个url中获取代码http://www.allshorevirtualstaffing.com/how-to-develop-basic-crud-operations-in-codeigniter/#.VORuXGPWS1E
application/views/templates
文件夹中缺少文件header.php
。
检查文件权限。如果您使用ftp覆盖这些文件(这很常见),您可能在不知情的情况下更改了文件权限和/或所有权。
class View extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function myview() {
$this->load->view('templates/header.php');
$this->load->view('templates/myview.php');
$this->load->view('templates/footer.php');
}
要加载视图,您必须编写example.com/index.php/view/myview在application/views/templates文件夹中的codeigniter中,您必须具有以上三个文件header.php、myview.php、footer.php