2013-12-11 79 views
1

我想从JSON字符串中创建一个xml。任何人都可以帮我解决这个问题。请在这里找到我的json。如何在cakephp中将Json转换为xml或数组到xml

{"Customer_CreateOnlyResponse":{"Customer_CreateOnlyResult":{"RequestID":"1212","Message":"Successfully created customer","Success":"true","CustomerID":"1212"}}} 

感谢您的提前帮助。

回答

0

起初,你可以用你的json_decode字符串数组解码和这个数组转换为XML的Xml Core library有:

例子:

$data = array(
    'post' => array(
     'id' => 1, 
     'title' => 'Best post', 
     'body' => ' ... ' 
    ) 
); 
$xml = Xml::build($data);