Laravel 5 change public_path()

后端 未结 6 1066
南方客
南方客 2020-11-27 12:26

I am trying to move the public folder to other place. However, I can\'t find the place to modify public_path() variable. Now, the \'public_path()\'

6条回答
  •  一整个雨季
    2020-11-27 12:44

    In my case in Laravel 6.0 work this.
    This file: bootstrap/app.php

    ......
    $app = new Illuminate\Foundation\Application(
        $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__) );
    
    $app->bind('path.public', function() {
        return realpath(__DIR__.'/../httpdocs'); });
    .....
    

    I changed the public_path() folder, this example is with httpdocs folder, you can put watherver you want.

提交回复
热议问题