【问题标题】:Laravel 5.2 Change public folder to public_html on shared server [duplicate]Laravel 5.2将公共文件夹更改为共享服务器上的public_html [重复]
【发布时间】:2016-12-23 01:05:25
【问题描述】:

我已将我的项目上传到 godaddy 并将公用文件夹内容移动到 public_html。项目运行良好,但干预图像无法写入公共路径,因为它不存在。以下是留言:

Can't write image data to path (/home/username/public/uploads/...

显然public_path() 是错误的,它仍然指向public。但现在应该是public_html。 所以我的问题是如何在 Laravel 5.2 中将其更改为 public_html

【问题讨论】:

  • 这个问题已经用相同的主题回答了
  • 考虑将public 符号链接到public_html

标签: php laravel-5.2


【解决方案1】:

在 index.php 中试试这个:

$app = require_once __DIR__.'/../bootstrap/app.php';

// set the public path to this directory
$app->bind('path.public', function() {
    return __DIR__;
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-10
    • 2019-08-01
    • 1970-01-01
    • 2015-07-23
    • 2021-07-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多