小编典典
假设您的服务器中具有此文件夹结构
.cpanel/
public_html/
public_ftp/
..
laravel文件夹结构是
app/
bootstrap/
public/
vendor/
composer.json
artisan
..
您可以在服务器上与public_html和内联的文件夹中创建一个名为mylaravelsite的public_ftp文件夹,然后将除公共文件夹之外的整个laravel应用程序复制到该文件夹中,因为您会将所有内容粘贴到上public_html,因此,您现在可以:
.cpanel/
public_html/
public_html/packages
public_html/vendor
public_html/index.php
public_html/.htaccess
...
public_ftp/
mylaravelsite/
mylaravelsite/app
mylaravelsite/bootstrap
...
在您的public_html/index.php更改中,以下行:
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/start.php';
至
require __DIR__.'/../mylaravelsite/bootstrap/autoload.php';
$app = require_once __DIR__.'/../mylaravelsite/bootstrap/start.php';
并且不要忘记更改 /mylaravelsite/bootstrap/paths.php公共路径,您可以使用它。
'public' => __DIR__.'/../public',
至
'public' => __DIR__.'/../../public_html',
您的网站应该正在运行。
2020-05-29