Php 代码点火器控制器不工作
我对web开发是新手,所以这个问题可能很简单 我已经安装并运行了xampp,并且正在使用netbeans的最新版本 我目前正试图遵循一个教程,该教程要求我制作两个控制器,但我唯一能成功加载的页面是index.php 我在应用程序/控制器文件夹中创建了一个新控制器:Php 代码点火器控制器不工作,php,codeigniter,controller,Php,Codeigniter,Controller,我对web开发是新手,所以这个问题可能很简单 我已经安装并运行了xampp,并且正在使用netbeans的最新版本 我目前正试图遵循一个教程,该教程要求我制作两个控制器,但我唯一能成功加载的页面是index.php 我在应用程序/控制器文件夹中创建了一个新控制器: <?php class Blog extends CI_Controller { public function index() { echo 'Say something'; } } ?
<?php
class Blog extends CI_Controller {
public function index()
{
echo 'Say something';
}
}
?>
但我有一个错误:
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
p、 美国
我已经编辑了.htaccess文件:
RewriteEngine on
RewriteCond %(REQUEST_FILENAME) !-f
RewriteCond %(REQUEST_FILENAME) !-d
RewriteRule ." index.php/$0 [PT,L]
我已经用谷歌搜索解决方案3个小时了,如果有任何帮助,我将不胜感激:)将.htaccess文件更改为:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
此外,请尝试通过以下方式访问:
http://localhost/Something/index.php/Blog
试试这个:
localhost/Something/index.php/controllername还可以在浏览器中的小url中写入
控制器类
和方法的名称。您可以通过以下方式访问:
http://localhost/index.php/something/blog
将此代码添加到我的帮助中
RewriteEngine on
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
试试这个:
http://localhost/index.php/something/blog
RewriteEngine on
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]