日期:2014-05-17 浏览次数:20521 次
<?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>
$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);