Blogger Information
Blog 64
fans 6
comment 2
visits 82979
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
ThinkPhp6.0 隐藏入口文件,开启路功能
王娇
Original
1765 people have browsed it
  • 开启路由功能

开启路由功能

开启强制路由

定义控制器,前后台分离

定义路由

  • 去掉入口文件index.php URL重写
    可以通过URL重写隐藏应用的入口文件index.php(也可以是其它的入口文件,但URL重写通常只能设置一个入口文件),下面是相关服务器的配置参考:

[ Apache ]
httpd.conf配置文件中加载了mod_rewrite.so模块
AllowOverride NoneNone改为 All
把下面的内容保存为.htaccess放在文件放到应用入口文件的同级目录下(放在public目录下)

  1. <IfModule mod_rewrite.c>
  2. Options +FollowSymlinks -Multiviews
  3. RewriteEngine On
  4. RewriteCond %{REQUEST_FILENAME} !-d
  5. RewriteCond %{REQUEST_FILENAME} !-f
  6. RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
  7. </IfModule>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post