在Codeigniter 4中未在此服务器上找到请求的URL 4
我在基本控制器中添加了URL助手,
protected $helpers = ['url'];
也将其称为Home Controller
class Home extends BaseController
{
public function index()
{
helper("url");
return view('index');
}
public function data()
{
helper("url");
return view('welcome_message');
}
}
.htaccess
公共文件夹中的文件
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
也从app.php文件中删除index.php
public $indexPage = '';
I added url helper in Base Controller
protected $helpers = ['url'];
also call it in Home Controller
class Home extends BaseController
{
public function index()
{
helper("url");
return view('index');
}
public function data()
{
helper("url");
return view('welcome_message');
}
}
.htaccess
file in public folder
RewriteEngine on
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
also remove index.php from app.php file
public $indexPage = '';
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论