我parsing
这个rss
与php
,我试图显示在YouTube video.In第一item
我得到一个错误,并且不显示视频。在第二个item
视频正常显示。
我必须从该行删除123.gr//
:解析RSS使用PHP,功能的preg_match“编辑:str_replace函数”
<iframe width="780" height="470" src="'http://123.gr///www.youtube.com/embed/WDK5BTuFMRM?rel=0&vq=hd1080" frameborder="0" allowfullscreen></iframe>
我认为这是一个好主意要做到这一点是使用explode function
,但我没有找到正确的路呢。
就拿在我的代码一看:
<?php
$html = "";
$url = "123.xml";
$xml = simplexml_load_file($url);
for ($i = 0; $i < 10; $i++){
$title = $xml->channel->item[$i]->title;
$description = $xml->channel->item[$i]->description;
print_r(explode('"',$description,5));
?>
<div data-role="content">
<div data-role="collapsible" data-theme="b">
<h3><?php echo $title ?></h3>
<p><?php echo $description ?></p>
</div>
</div>
<?php
}
?>
这里是RSS
<item>
<title>This is the title</title>
<description>
<![CDATA[Some text
<p>
<div align="center">
<iframe width="780" height="470" src="'http://123.gr///www.youtube.com/embed/WDK5BTuFMRM?rel=0&vq=hd1080" frameborder="0" allowfullscreen></iframe>
</div>
]]>
</description>
</item>
<item>
<title>This is the title</title>
<description>
<![CDATA[Some text
<p>
<div align="center">
<iframe width="780" height="470" src="'http://www.youtube.com/embed/WDK5BTuFMRM?rel=0&vq=hd1080" frameborder="0" allowfullscreen></iframe>
</div>
]]>
</description>
</item>
任何帮助将不胜感激
谢谢您的回答本杰明,但我需要保持iframe元素
实际上我希望以src开始:src =“http://youtube.com/ .. ...“ – marYOs
了解它是如何工作的。晚上我会上传代码! – marYOs