您好,欢迎访问一九零五行业门户网

apache - CentOS上部署PHP框架CodeIgniter,调用控制器的时候出现404错误如何解决?

ci版本为3.0 dev。
在本地虚拟机centos 6.3 和 windows上部署好后,
本机数据库能正确连接
本机controllers能正确调用,通过url也能正确访问
# /application/config/config.php$config['base_url'] = '';$config['index_page'] = 'index.php';$config['uri_protocol'] = 'auto';$config['url_suffix'] = '';$config['enable_hooks'] = false;$config['subclass_prefix'] = 'my_';

======================================
但是部署到阿里云服务器上后
index.php->
controllers welcome.php->
views welcome_message.php->
首页的welcome_message.php依然能正确显示,但是一旦调用自己写的控制器就报错404:
这是我自己写的控制器:
load->database(); $this->load->helper('url'); } function index() { $id=$_post['id']; $this->load->model('getmodel'); $data = $this->getmodel->getone($id); $output = json_encode($data); $userinfo = '[{msgtype:3}]'; $query['getuser_output'] = $userinfo.$output; $this->load->view('welcome_message',$query); }}/* end of file userinfo.php *//* location: ./application/controllers/userinfo.php */

php版本是5.3.3 默认配置
apache版本是2.2.15 默认配置
centos版本是 6.3 x64 关闭了selinux
请问大概是哪个环节出了问题?
回复内容: ci版本为3.0 dev。
在本地虚拟机centos 6.3 和 windows上部署好后,
本机数据库能正确连接
本机controllers能正确调用,通过url也能正确访问
# /application/config/config.php$config['base_url'] = '';$config['index_page'] = 'index.php';$config['uri_protocol'] = 'auto';$config['url_suffix'] = '';$config['enable_hooks'] = false;$config['subclass_prefix'] = 'my_';

======================================
但是部署到阿里云服务器上后
index.php->
controllers welcome.php->
views welcome_message.php->
首页的welcome_message.php依然能正确显示,但是一旦调用自己写的控制器就报错404:
这是我自己写的控制器:
load->database(); $this->load->helper('url'); } function index() { $id=$_post['id']; $this->load->model('getmodel'); $data = $this->getmodel->getone($id); $output = json_encode($data); $userinfo = '[{msgtype:3}]'; $query['getuser_output'] = $userinfo.$output; $this->load->view('welcome_message',$query); }}/* end of file userinfo.php *//* location: ./application/controllers/userinfo.php */

php版本是5.3.3 默认配置
apache版本是2.2.15 默认配置
centos版本是 6.3 x64 关闭了selinux
请问大概是哪个环节出了问题?
把这个controller的index设置成default页面呢
404一般是路由错了
弱弱的问一句和pathinfo有关系吗
把你的 方法:userinfo() 改成:__construct()
其它类似信息

推荐信息