Escape spaces in glob() in PHP?

前端 未结 1 695
面向向阳花
面向向阳花 2021-01-26 13:03

I have the following function in PHP, which is working great except for files with spaces in their names (Good picture.jpg for example). Here it is:



        
1条回答
  •  迷失自我
    2021-01-26 13:24

    As explained here, try using this code to escape space in filename when using glob:

    $albumEscaped = str_replace(' ', '\ ', $currentalbum); 
    $photos = glob($albumEscaped .'/*.[Jj][Pp][Gg]');
    

    0 讨论(0)
提交回复
热议问题