PHP提取XML问题
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?xml version="1.0" encoding="utf-8"?> <user> <person_siteurl>http://www.163.com</person_siteurl> <job_keys>PHP</job_keys> <job_keys>JAVA</job_keys> <job_keys>PYTHON</job_keys> <email>jack@sina.com</email> </user>
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> $arr = array( 'person_siteurl'=>'http://www.163.com', 'job_keys'=>'php,java,python', 'email'=>'jack@sina.com' )
$arr=(array)simplexml_load_file('user.xml'); $res=array_map(function($param){return is_array($param)?implode(',',$param):$param;},$arr); print_r($res); <div class="clear"> </div>