Php 在CodeIgniter上找不到页面
也许你能帮我。我的codeigniter设置有问题。这是一个全新的安装,我所做的只是对欢迎控制器执行以下操作:Php 在CodeIgniter上找不到页面,php,codeigniter,Php,Codeigniter,也许你能帮我。我的codeigniter设置有问题。这是一个全新的安装,我所做的只是对欢迎控制器执行以下操作: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Welcome extends CI_Controller { function __construct() { parent::__construct(); } f
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct()
{
parent::__construct();
}
function index()
{
$this->load->view('welcome_message');
}
function test()
{
echo "test";
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
此错误(未找到HTTP 404)表示
那个Internet Explorer能够
连接到网站,但不连接页面
找不到你想要的。它是
可能该网页是
暂时不可用。
或者,该网站可能有
已更改或删除网页。对于
有关HTTP错误的更多信息,
请看帮助
如果我试图访问一个不存在的页面,我会得到404个错误,这是我所期望的。尝试将您的uri\u协议设置为
$config['uri_protocol']=“请求_uri”;
这是我的访问权限
#如果我们没有安装mod_rewrite,所有404
#可以发送到index.php,一切正常。
#提交人:ElliotHaughin
a2enmod rewrite /etc/init.d/apache2
reload
嘿,约翰·内森,很高兴我能解决你的问题。您所要做的就是启用apache的mod rewrite
因为您没有使用apache的mod rewrite,code igniter一定是弄乱了一些重写规则,把您的表单数据弄乱了。我建议您尝试使用uri\u协议。。。CI2对这些设置非常不合作。。。
Go back to the previous page.
Go to and look for the information you want.
More information
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #When your application folder isn't in the system folder #This snippet prevents user access to the application folder #Submitted by: Fabdrol #Rename 'application' to your applications folder name. RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L]
ErrorDocument 404 /index.php
a2enmod rewrite /etc/init.d/apache2 reload