problem with mapping preg_replace to images
I have this code
$imageMap=preg_replace('/([a-z ])/', '<img src="egypt/$1.png" />', $input);
Which works for a-z
but when it co开发者_JS百科mes to a 'space'
being inputted, it looks for ' .png'
which i have in the folder but it says:
Not Found
The requested URL /egypt/ .png was not found on this server.
I noticed that in the url it displayed /egypt/%20.png
, so when i put another image called '%20.png'
it still said not found on the server.
Any suggestions guys?
Do not name files like space.png - many systems just trims (cuts the space on beginig) name of the file and it is really messy then. Naming file like this is not correct and causes problems like this.
精彩评论