Html 如何从带有空格的图像名称中删除+符号

Html 如何从带有空格的图像名称中删除+符号,html,laravel,url,imageurl,Html,Laravel,Url,Imageurl,我有一个注册用户和用户图像的系统。一些用户图像使用空格Ex-:Prof Pic.jpeg重命名 现在我尝试检索用户图像,它显示+符号连接到URL https://my.space/photos/49/profile/Prof+Pic.jpeg 预期产量为 https://my.space/photos/49/profile/Prof Pic.jpeg 如果这是数据库中的内容,请执行此操作。取决于数据库中的内容。例如,Prof Pic.jpeg,profile/Prof Pic.jpeg 您可

我有一个注册用户和用户图像的系统。一些用户图像使用空格Ex-:Prof Pic.jpeg重命名

现在我尝试检索用户图像,它显示+符号连接到URL

https://my.space/photos/49/profile/Prof+Pic.jpeg
预期产量为

https://my.space/photos/49/profile/Prof Pic.jpeg

如果这是数据库中的内容,请执行此操作。取决于数据库中的内容。例如,Prof Pic.jpeg,profile/Prof Pic.jpeg

您可以通过添加来删除它

$getImgUrl=DB::table('table')->where('id',$request->input('id'))->first();

$url = $getImgUrl->imgurl;

$removeSpace=preg_replace('/\s/', '', $url);

现在可以使用$removeSpace

https://my.space/photos/49/profile/Prof Pic.jpeg是无效的URL。禁止使用文字空格。+指URL中的空格。按你的要求去做是没有意义的。@Quentin但问题是我不能用+来查看图像。我们可以查看任何代码吗?@AliRasheed src={{$data['receiverimage']}}}@Fed你能用空格查看吗?
$getImgUrl=DB::table('table')->where('id',$request->input('id'))->first();

$url = $getImgUrl->imgurl;

$removeSpace=preg_replace('/\s/', '', $url);