簡體   English   中英

laravel,如何將圖像存儲到public_html目錄

[英]laravel, how to store images to public_html directory

在我的主機上,我具有'public_html' ,而不是“ public”目錄名稱II已將公共路徑綁定到public_html directory in index.php文件中的public_html directory in index.php

$app->bind('path.public', function() {
  return base_path().'/public_html';
});

現在public_path()輔助函數返回帶有public_html的路徑(正確)

而且,我的磁盤位於filesystem.php文件中

'my_upload' => [
        'driver' => 'local',
        'root' => public_path().'/images/adverts',
        'visibility' => 'public',
    ],

一切對我來說都很好,但是當我上傳一些文件時,laravel將它們放在'public' directory 我需要將它們放在'public_html'

(我需要公共目錄中的圖像,因為我的主機不提供鏈接做存儲文件夾)

提前致謝

嘗試存儲如下文件:

if(!Storage::disk('my_upload')->put($path, $file_content)) {
    return false;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM