带有空格的PHP rawurlencode路径在can';找不到文件
我有这样一个文件路径:带有空格的PHP rawurlencode路径在can';找不到文件,php,urlencode,Php,Urlencode,我有这样一个文件路径: /example/img/letter\u images/第二章海勒家族 使用名为Letter#1等的子文件夹。当我尝试在该文件夹中显示图像时,使用: <?php class struct { public static function imageDisplayGallery($img_folder_path) { $index=0; foreach(glob("$img_folder_path*/*_thumb.
/example/img/letter\u images/第二章海勒家族
使用名为Letter#1
等的子文件夹。当我尝试在该文件夹中显示图像时,使用:
<?php
class struct
{
public static function imageDisplayGallery($img_folder_path)
{
$index=0;
foreach(glob("$img_folder_path*/*_thumb.jpg") as $thumb)
{
$full=str_replace("_thumb","",$thumb);
//echo "$full-$thumb";
echo '<a href="',rawurlencode($full),'" class="photo-link smoothbox" rel="gallery"><img src="',rawurlencode($thumb),'" /></a>';
$index=$index+1;
if($index % 6 == 0)
{
echo '<div class="clear"></div>';
$index=0;
}
}
}
}
$images=struct::imageDisplayGallery('img/letter_images/Chapter 2 The Heller Family/');
?>
没有找到。有人能解释为什么会这样吗
当我只使用
urlencode
时,我得到的是+
而不是空格(这显然是错误的)。我还可以尝试解决什么问题?示例与错误不匹配,链接中的文件夹名称在哪里?@PedroLobito谢谢-我在尝试简化示例时省略了一些必要的代码。它对斜杠进行编码/
。将%2F
替换为解决我问题的/
@Deadooshka。如果你将它作为一个答案张贴,我会接受它
http://www.example.com/img%2Fletter_images%2FChapter%202%20%20%20%…%20%20%20%20The%20Heller%20Family%2FLetter%20%23%209%2Fpfr100350_thumb.jpg