繁体   English   中英

在codeigniter中未访问home.php

[英]home.php not being accessed in codeigniter

我在CI上设置了一些站点,但最新站点却不合作:浏览域不会触发home.php。 我得到“未指定输入文件”。 我一定想念吗? (顺便说一句,当我在根目录中放置一个测试index.php文件时,回显代码会呈现出来)这就是我已经设置的内容-

//permissions:
//all subdirectories & file set to 755

//config.php:
$config[‘base_url’] = ‘http://example.com’;
$config[‘index_page’] = ‘home’;

//htaccess in root:
RewriteEngine on
RewriteCond $1 !^(index\.php)
RewriteRule ^(.*)$ /index.php/$1 [L]

//routes.php:
$route[‘default_controller’] = “home”;
$route[‘404_override’] = ‘’;

//home.php:
class Home extends CI_Controller {
public function index()
 {
  $this->load->library('session');
  $this->load->view('main_view');
  }
}

我的设置似乎反映了我其他正在运行的CI网站的设置,但我肯定缺少某些内容。 感谢您对我还应该寻找的反馈。 谢谢

由于要从URI中删除index.php ,因此无需在config.php指定index_page 设置$config['index_page'] = ''; 应该可以解决您的问题。 您可以保留$route['default_controller'] ,因为CodeIgniter自动默认为index方法。

您的“ default_controller”配置必须为“ home / index”

另外,请确保将默认配置放在文件底部。 在CI路由文件中,始终从最具体到最一般...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM