TP5使用路由模式报错 No input file specified.

  1. application/route.php 是设置路由的文件。
    这里写图片描述
  2. 将 route.php 代码修改为
<?php

use think\Route;
Route::rule("hello","index/index/index");
  1. 然后访问报错 No input file specified.
    这里写图片描述
  2. 这是因为重写规则有问题,由于我本地使用的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>
  1. 重新访问。
    这里写图片描述
  2. 注意:这时候如果再使用 pathinfo 访问(http://z.cn/index/index/index)则会提示 页面错误!请稍后再试~

thanks~

猜你喜欢

转载自blog.csdn.net/xianhenyuan/article/details/81208642
今日推荐