我是codeIgniter framework
的新手,当我在子域的linux服务器上上传codeigniter网站时,它给出了error
" Unable to load the requested file: Home'home.php
",但在我的本地windows机器上工作正常,我检查了大小写敏感问题,但这些都很好,我也检查了.htaccess
文件,但没有成功。任何建议。
这是我的控制器"home.php":
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->template->set('nav', 'home');
$this->load->model('Home_model', 'home');
}
public function index()
{
$this->template->set('title', 'Books Bazaar : Home');
$this->template->load('template', 'Home'home');
}
?>
和我的。htaccess文件包含:
DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
域,我上传的网站是:http://books.atntechnologies.com/
谢谢
codeigniter就是这样检查你的文件的
function load($tpl_view, $body_view = null, $data = null)
{
if ( ! is_null( $body_view ) )
{
if ( file_exists( APPPATH.'views/'.$tpl_view.'/'.$body_view ) )
{
$body_view_path = $tpl_view.'/'.$body_view;
}
else if ( file_exists( APPPATH.'views/'.$tpl_view.'/'.$body_view.'.php' ) )
{
$body_view_path = $tpl_view.'/'.$body_view.'.php';
}
else if ( file_exists( APPPATH.'views/'.$body_view ) )
{
$body_view_path = $body_view;
}
else if ( file_exists( APPPATH.'views/'.$body_view.'.php' ) )
{
$body_view_path = $body_view.'.php';
}
else
{
show_error('Unable to load the requested file: ' . $tpl_name.'/'.$view_name.'.php');
}
$body = $this->ci->load->view($body_view_path, $data, TRUE);
if ( is_null($data) )
{
$data = array('body' => $body);
}
else if ( is_array($data) )
{
$data['body'] = $body;
}
else if ( is_object($data) )
{
$data->body = $body;
}
}
$this->ci->load->view('templates/'.$tpl_view, $data);
}
所以$this->template->load('template', 'Home'home');
需要'/'
而不是'''