CI4的路由到底改成什么样了?
.htaccessRewriteEngine On
RewriteBase /
RewriteCond %{ENV:REDIRECT_APP_PATH} !^$
RewriteRule ^(.*)$ -
RewriteCond %{ENV:APP_PATH} ^$
RewriteRule ^(.*)$ -
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php
#RewriteRule ^(.*)$ index.php/$1
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* -
-------
App.php
public $indexPage = '';
------
Routes.php
$routes->get('/', 'Home::index');
$routes->get('xx', 'Home::xx');
-----
Home.php
public function index()
{
return view('welcome_message');
}
public function xx()
{
echo "xx";
}
----
但为什么
http://127.0.0.1:2405/可以正常浏览,而
http://127.0.0.1:2405/xx 却显示No input file specified.
Routes.php改成
$routes->add('xx', 'Home\xx');
也一样出同样的错误。
http://127.0.0.1:2405/index.php/home/xx 却反而可以访问 伪静态问题,检查一下环境。。。。。。。
感觉根目录已经变到public里了。外国资料是将public的index.php和.htaccess复制到根目录下面进行,我试了还不行。最后找了ci3的.htaccess放到public里面,http://127.0.0.1:2405/home/xx可以访问了。 不用定义routers.php,\app\Controllers写了Products.php,http://127.0.0.1:2405/products 也可以访问了
页:
[1]