PHP版本: 7.4.30
我使用simplexml_load_file php函数,
$rss = simplexml_load_file($url, 'SimpleXMLElement', LIBXML_NOCDATA);xml rss文件示例:
<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
<channel>
<title>AAA</title>
<link>https://aaa.com</link>
<description>description</description>
<item>
<title>PRODUCTS EXPO 2022 in 神戸 ダイジェスト</title>
</item>
</channel>
</rss>ˆ产出标题[$rss->通道->项目->标题]:2022年产品博览会in原žˆ,ˆˆƒƒEXPO,EXPO,ˆ§,ƒˆ
如何获得标题:2022年在举办的神戸ダイジェスト产品博览会
发布于 2022-10-26 08:38:15
我将这一行更改为xml字符以进行更正。都很好。
$rss = simplexml_load_file($rsses[$i]['url'], 'SimpleXMLElement', LIBXML_NOCDATA);至
$feed = file_get_contents($rsses[$i]['url']);
$rss = simplexml_load_string($feed);https://stackoverflow.com/questions/74203645
复制相似问题