dongyuchen0214 2012-02-11 01:33
浏览 43
已采纳

PHP preg_replace URI在phpBB中

I'm trying to replace some image URI's in some phpBB forum post content retrieved from the DB for an external page.

preg_replace('/((https?|ftp).*\.(gif|png|jpg|jpeg))/i', '<img src="$1" alt "" />','http://somesite.com/image.png awordcontainingpng');

The above works well and as expected.

The thing is, when I try to apply the same to the MySQL result, nothing gets matched. Matches seem to work when I remove the escaped dot

E.g.:

preg_replace('/((https?|ftp).*(gif|png|jpg|jpeg))/i', '<img src="$1" />',$phpbb_post);  

But that's no good. The data is BLOB type - I don't know if that makes a difference. Could anyone help me with this?

Thanks.

  • 写回答

2条回答 默认 最新

  • dongyingla8668 2012-02-11 01:54
    关注

    In PHPBB, when the images are saved into the database, they are totally encoded. This means that the dot . is replaced by a &#46;.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥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 悬赏!微信开发者工具报错,求帮改