douling0053 2012-11-05 06:25
浏览 40
已采纳

如何在php中搜索和删除字符串

I am attempting to use an RSS feed from Twitter (the ones that will be gone a year from now) with Feedburner but a line of code in the xml is causing a parsing error in feedburner. I think it's

xmlns:twitter="http://api.twitter.com"

I am looking for a way to give this information to feedburner in a way that it likes: namely php including the contents of the RSS xml page in an xml on my own site (with the offending string removed). Including the xml contents is a piece of cake - all I need is a piece of code to say iff string fragment == xmlns:twitter="http://api.twitter.com" then string frament = "".

Anybody any idea of the syntax for this?

  • 写回答

2条回答 默认 最新

  • dry9192 2012-11-05 06:30
    关注

    You can try with str_replace:

    str_replace('xmlns:twitter="http://api.twitter.com"', '', $string);
    

    Also, you can try to urlencode http://api.twitter.com.

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

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部