Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.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 图像url中的空白问题_Php_Swiper - Fatal编程技术网

Php 图像url中的空白问题

Php 图像url中的空白问题,php,swiper,Php,Swiper,漂亮的旋转木马;)谢谢你出色的工作!! 我发现了一个小“bug”: 如果图片url包含任何空格,则不会显示。 例如:picture.jpg返回: 展示 但是这个用于空格的“%20”html插入允许图像不显示在swiper中。 原因是什么???现在我用以下方法修复了它: foreach ($json_data as $Data => $imagelink) { $image = str_replace(' ', '%20', $imagelink['imagelink']); .....

漂亮的旋转木马;)谢谢你出色的工作!! 我发现了一个小“bug”:

如果图片url包含任何空格,则不会显示。 例如:picture.jpg返回: 展示

但是这个用于空格的“%20”html插入允许图像不显示在swiper中。
原因是什么???

现在我用以下方法修复了它:

foreach ($json_data as $Data => $imagelink) {
$image = str_replace(' ', '%20', $imagelink['imagelink']); 

.....
}

如果将其替换为
\uu
而不是空格,效果会更好为什么@AbhishekKamal的图像文件名实际上有空格?自答式解决方案。旁白:我也喜欢下划线。但是使用OP的解决方案,我可以在以后打开文件名中的空格,如果需要的话。我的意思是,如果在上传到服务器或保存到数据库之前,用下划线
\uuu
替换文件名中的所有空格,这是一种更好的编码实践。这将像@estebu所做的那样在将来节省时间。