[英]Codeigniter controller method 404 error
我今天使用以下链接从github克隆了Codeigniter的副本: https : //github.com/bcit-ci/CodeIgniter.git 。 我当前正在运行MAMP安装程序,以便http:// localhost:8888指向我的htdocs文件夹。 我的根文件夹称为“时间”。 当我转到http:// localhost:8888 / time / index.php时 ,确实看到了Codeigniter欢迎页面。 另外,即使我在根目录中没有.htaccess文件,也可以转到http:// localhost:8888 / time /并看到相同的欢迎页面。
这是问题所在。 我在Welcome.php控制器类中添加了以下功能:
public function test()
{
echo 'Test';
}
当我访问http:// localhost:8888 / time / index.php / test时,这应该显示一个显示“ test”的页面。 但是,我得到一个404页面未找到错误。 有人对理解和解决此问题有任何建议吗?
因为localhost/index.php/test
不引用欢迎控制器中的方法test。 您将必须转到localhost/index.php/welcome/test
或使用路由。
它们执行操作的方式意味着存在一个名为Test.php
的控制器,并且它正在尝试转到该控制器的index()
函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.