如何将laravel目录从storage/app/public更改为public/media



请将服务器上的默认laravel配置从storage/app/public更改为public/media。在localhost中,它使用storage:link,但在服务器上,即使添加了符号链接,它也不起作用。下面是我的符号链接代码。

<?php symlink('/home/cemo/cem/storage/app/public','/home/cemo/public_html');

此外,如果我从存储函数i get/home/cemo/cem/public 返回public_path((

这是我的面板的结构

下面是我使用图像干预的商店功能

public function store(Request $request)
{
return public_path();
$this->validate($request,[
'title'=>'required|min:6',
'body'=>'required'
]);
if($request->hasFile('image')){
$img = $request->file('image');
$imgName = time().'-'.uniqid() . '.' . $img->getClientOriginalExtension();
}
else{
$imgName = 'default.jpg';
}
$posts = new post;
$posts->title = $request->title;
$posts->body = $request->body;
$posts->posted_by = $request->posted_by;
$posts->status = $request->status;
$posts->position = $request->position;
$posts->image = $imgName;
$posts->source = $request->source;

$posts->save();
$posts->tags()->sync($request->tags);
if(!empty($img)){
Image::make($img)->resize(1500,550)->save(public_path('/media/images/blog/'. $imgName));
}
$notification = array(
'message' => 'Successfully created',
'alert-type' => 'success'
);
return redirect(route('post.index'))->with($notification);
}

在config/filessystems.php 中

将阵列更改为:

'root' => 'public/media',

相关内容

最新更新