我在使用模型视图控制器的第一步中遇到了问题。
我无法正确获取网址。
如果我输入的url是http://localhost/admin/我认为它无效。这就是我想要捕捉的。
但是,如果我通过http://localhost/index.php/admin我正确地捕捉到了它。
我读了很多书,但都没有成功。
httpd.conf中的重写模块处于活动状态。我已经将All和Grant放在项目目录中。
我的httpd.conf是
#LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
#LoadModule sed_module modules/mod_sed.so
DocumentRoot "C:/laragon/www/Atenea_MVC/public"
<Directory "C:/laragon/www/Atenea_MVC/public">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
我的代码是
$router -> get('/admin' , [PropiedadController::class , 'index']);
但只有当我通过url时,这个get才有效http://localhost/index.php/admin
我真的很陌生。我正在学习,这是我第一个无法通过研究解决的问题。
非常感谢大家。
不确定,但请检查/public 中的.htaccess文件