CodeIgniter 4.0反复向我显示404错误
我通过CodeIgniter文档编写了相应的控制器,但是页面总是向我显示404。我的问题是为什么不能显示同一URL,以及为什么此框架只能显示404页。我记得ThinkPHP具有一个完整的运行链接以进行错误报告,我看不到一个404的问题。
这是我的URL http://localhost/index.php/demo/test
这是我的demo.php代码
`<?php
use CodeIgniter\Controller;
class Demo extends Controller
{
public function test()
{
echo 1;
}
}`
演示。 PHP文件必须在控制器文件夹中,并且没有其他目录,但是CI向我报告404错误
I wrote the corresponding controller through the CodeIgniter document, but the page always shows me 404. My question is why exactly the same URL can not be displayed, and why this framework can only show me 404 pages. I remember that ThinkPHP has a complete running link for error reporting, and I can't see the problem with only one 404.
this is my url
http://localhost/index.php/demo/test
this is my Demo.php code
`<?php
use CodeIgniter\Controller;
class Demo extends Controller
{
public function test()
{
echo 1;
}
}`
Demo. PHP files must be in the controller folder and there are no other directories, but CI reports 404 errors to me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它是因为它们发生了巨大更改的路线,因此您需要在\ config \ routes.php中定义并在我重构脚本的过程中检查其Wiki。
Its because they dramatically changed routes, you need to define in \Config\Routes.php and check their wiki as I am in process of refactoring my scripts.
使用此路由添加一条路由,
以确保您的服务器启用了MOD_REWRITE,并且您的服务器具有.htacces文件。
确保您的base_url在app/config/app.php中设置为URL/
Add a route with this
ensure your server has mod_rewrite enabled and that you have .htacces file.
make sure that your base_url in app/Config/App.php is set with an ending slash on the url /