tp6修改入口文件位置

1.正常入口文件位置

|-thinkphp6
|–public
|—index.php

2.想修改为(就是把public目录向上移一级)

|-thinkphp6
|-public
|–index.php

3.改怎么修改index.php里面的内容呢

// [ 应用入口文件 ]
namespace think;
require __DIR__ . '/../vendor/autoload.php';
// 执行HTTP应用并响应
$http = (new App())->http;

$response = $http->run();

$response->send();

$http->end($response);
讨论数量: 7

理论上改这一行就可以。

- require __DIR__ . '/../vendor/autoload.php';
+ require __DIR__ . '/vendor/autoload.php';
1年前 评论
laravel_v (楼主) 1年前
laravel_v (楼主) 1年前

这样操作影响安全性吧?

1年前 评论

最好不要,以前index.php跟框架在同一级目录,这几年项目框架都使用public目录,这是为了更高的安全性考虑的

1年前 评论
laravel_v (楼主) 1年前
  • require DIR . '/../vendor/autoload.php';
  • require DIR . '/vendor/autoload.php';
1年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!