2009-01-29 58 views

回答

5

这是

App::import('Xml'); 
$url = "http://www.example.com/xml_file.xml"; 
$parsed_xml =& new XML($url); 

只使用URL中的文件,而不是简单的蛋糕将在内部选择的方式打开文件

+0

在CakePHP中2,语法将看起来不同,请检查 http://book.cakephp.org/2.0/en/core-utility-libraries/xml.html – 2015-09-21 20:58:13

1
$contents = file_get_contents("http://www.site.com/file.xml"); 
$file = fopen("temp.xml", "rb"); 
fwrite($file, $contents); 
fclose($file); 
unset($contents) 

App::import('Xml'); 
$file = "temp.xml"; 
$parsed_xml =& new XML($file); 

:)