Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将附件从rss提要提取到图像中_Php_Xml - Fatal编程技术网

Php 将附件从rss提要提取到图像中

Php 将附件从rss提要提取到图像中,php,xml,Php,Xml,我需要从这个附件中提取图像url。我如何访问它 ["enclosure"]=> object(SimpleXMLElement) { ["@attributes"]=> array(3) { ["url"]=> string(81) "http://image.jpg" ["length"]=> string(4) "5000" ["type"]=> string(10) "image/jpeg" }

我需要从这个附件中提取图像url。我如何访问它

["enclosure"]=> object(SimpleXMLElement) {
    ["@attributes"]=> array(3) {
        ["url"]=> string(81) "http://image.jpg"
        ["length"]=> string(4) "5000"
        ["type"]=> string(10) "image/jpeg"
    }
}  
$url = (string) $var['enclosure']->attributes()->url;