- application/route.php 是设置路由的文件。
- 将 route.php 代码修改为
<?php
use think\Route;
Route::rule("hello","index/index/index");
- 然后访问报错 No input file specified.
- 这是因为重写规则有问题,由于我本地使用的apache ,所以我们去 public目录修改下.htaccess 文件即可。
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?$1 [QSA,PT,L]
</IfModule>
- 重新访问。
- 注意:这时候如果再使用 pathinfo 访问(http://z.cn/index/index/index)则会提示 页面错误!请稍后再试~
thanks~