如何实现ThinkPHP隐藏入口文件功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计217个文字,预计阅读时间需要1分钟。
初始url格式:http://localhost/tp5/public/index.php/index
1. 将index.php和+.htaccess文件移出至Public文件级目录;
2.修改index.php,添加namespace think;,并加载基础文件:require __DIR__ . '/thinkphp/base.php';
初始url样式:localhost/tp5/public/index.php/index
1、将 index.php 和 .htacess 文件移出到和Public 文件平级目录;
2、修改 index.php
namespace think; // 加载基础文件 require __DIR__ . '/thinkphp/base.php'; // 支持事先使用静态方法设置Request对象和Config对象 // 执行应用并响应 Container::get('app')->run()->send();
3、修改 .htaccess 文件
<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样式:localhost/tp5/index
推荐教程:《TP5》
以上就是thinkphp中隐藏入口文件的方法的详细内容,更多请关注自由互联其它相关文章!
本文共计217个文字,预计阅读时间需要1分钟。
初始url格式:http://localhost/tp5/public/index.php/index
1. 将index.php和+.htaccess文件移出至Public文件级目录;
2.修改index.php,添加namespace think;,并加载基础文件:require __DIR__ . '/thinkphp/base.php';
初始url样式:localhost/tp5/public/index.php/index
1、将 index.php 和 .htacess 文件移出到和Public 文件平级目录;
2、修改 index.php
namespace think; // 加载基础文件 require __DIR__ . '/thinkphp/base.php'; // 支持事先使用静态方法设置Request对象和Config对象 // 执行应用并响应 Container::get('app')->run()->send();
3、修改 .htaccess 文件
<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样式:localhost/tp5/index
推荐教程:《TP5》
以上就是thinkphp中隐藏入口文件的方法的详细内容,更多请关注自由互联其它相关文章!

