Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Cpanel上上传Laravel项目中的图像_Php_Laravel - Fatal编程技术网

Php 在Cpanel上上传Laravel项目中的图像

Php 在Cpanel上上传Laravel项目中的图像,php,laravel,Php,Laravel,上传图片是我的职责,但问题是为什么图片没有上传到公共html文件夹?图片上传到项目的公共文件夹 private function upload($image, $tbl) { $name = $image->getClientOriginalName(); $newName = date('ymdgis') . $name; $image->move(public_path() . '/img' . $tbl, $newName); retu

上传图片是我的职责,但问题是为什么图片没有上传到公共html文件夹?图片上传到项目的公共文件夹

private function upload($image, $tbl)
{
    $name    = $image->getClientOriginalName();
    $newName = date('ymdgis') . $name;

    $image->move(public_path() . '/img' . $tbl, $newName);

    return $newName;
}

AppServiceProvider
中,将此代码放入
寄存器()


谢谢您,亲爱的先生,它成功了。如果有帮助,请将答案标记为已接受:)
public function register()
{
    $this->app->bind('path.public', function() {
        return base_path('../public_html');
    });
}