php - file_get_contents - Downloading files with spaces in the filename not working
问题 I am trying to download files using file_get_contents() function. However if the location of the file is http://www.example.com/some name.jpg , the function fails to download this. But if the URL is given as http://www.example.com/some%20name.jpg , the same gets downloaded. I tried rawurlencode() but this coverts all the characters in the URL and the download fails again. Can someone please suggest a solution for this? 回答1: I think this will work for you: function file_url($url){ $parts =