dongmi0760 2011-06-12 22:44
浏览 26
已采纳

将preg_replace映射到图像的问题

I have this code

$imageMap=preg_replace('/([a-z ])/', '<img src="egypt/$1.png" />', $input);

Which works for a-z but when it comes 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?

  • 写回答

1条回答 默认 最新

  • duanqiao1961 2011-06-12 22:47
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改