百搜论坛欢迎您的加入!
adimg adimg
 
昨日:篇  今日:篇   总帖:篇   会员:
博主最大Lv63   
thinkphp中隐藏入口文件的方法     

初始url样式:http://localhost/tp5/public/index.php/index

1、将 index.php 和 .htacess 文件移出到和Public 文件平级目录;

2、修改 index.php

1

2

3

4

5

6

7

8

9

namespace think;

  

// 加载基础文件

require __DIR__ . '/thinkphp/base.php';

  

// 支持事先使用静态方法设置Request对象和Config对象

  

// 执行应用并响应

Container::get('app')->run()->send();

3、修改 .htaccess 文件

1

2

3

4

5

6

7

8

<IfModule mod_rewrite.c>

  Options +FollowSymlinks -Multiviews

  RewriteEngine On

  

  RewriteCond %{REQUEST_FILENAME} !-d

  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]

</IfModule>

最终url样式:http://localhost/tp5/index

推荐教程:《TP5

以上就是thinkphp中隐藏入口文件的方法的详细内容

 0  已被阅读了1170次  楼主 2020-06-23 10:23:28
回复列表

回复:thinkphp中隐藏入口文件的方法

联系站长 友链申请桂ICP备19000949号-1     桂ICP备19000949号-1
您的IP:3.145.2.184,2024-05-08 11:04:38,Processed in 0.0164 second(s).
免责声明: 本网不承担任何由内容提供商提供的信息所引起的争议和法律责任。
Powered by HadSky 7.12.9
已有0次打赏
(0) 分享
分享
取消
免责声明
1、本站资源,均来自网络,版权归原作者,所有资源和文章仅限用于学习和研究目的 。
2、不得用于商业或非法用途,否则,一切责任由该用户承担 !
如果觉得本文还不错请点个赞或者打赏点轻币哦~
拒绝伸手党,拿走请回复,尊重楼主,尊重你我他~

侵权删除请致信 E-Mail:207882320@qq.com