如何剥离谷歌新闻 json 提要链接的网址


How do I strip the url of a google news json feed link

如何剥离谷歌新闻json提要链接的网址?

我的链接看起来像这样

http%253A%252F%252Fwww.boston.com%252Fbusiness%252Fnews%252F2014%252F12%252F04%252Fnasa-poised-usher-new-era-with-orion-launch%252FGOh9asOZiRJPHbNw60otUK%252Fstory.html

我使用了以下代码

strip_tags("".$row['url']."");

这不做任何事情,我猜这是可能的,我使用了错误的 php 函数。

你可以为此使用 urldecode。

$url = "http%253A%252F%252Fwww.boston.com%252Fbusiness%252Fnews%252F2014%252F12%252F04%252Fnasa-poised-usher-new-era-with-orion-launch%252FGOh9asOZiRJPHbNw60otUK%252Fstory.html";
$url = urldecode(urldecode($url));
echo $url; // Will output: http://www.boston.com/business/news/2014/12/04/nasa-poised-usher-new-era-with-orion-launch/GOh9asOZiRJPHbNw60otUK/story.html