如何在cakephp中将Json转换为xml或将数组转换为xml
我正在尝试从JSON字符串创建一个xml。有人能帮我解决这个问题吗。请在这里找到我的json如何在cakephp中将Json转换为xml或将数组转换为xml,xml,json,cakephp-2.0,Xml,Json,Cakephp 2.0,我正在尝试从JSON字符串创建一个xml。有人能帮我解决这个问题吗。请在这里找到我的json {"Customer_CreateOnlyResponse":{"Customer_CreateOnlyResult":{"RequestID":"1212","Message":"Successfully created customer","Success":"true","CustomerID":"1212"}}} 感谢您的提前帮助。首先,您可以使用以下方法将字符串解码为数组,并将此数组转换为
{"Customer_CreateOnlyResponse":{"Customer_CreateOnlyResult":{"RequestID":"1212","Message":"Successfully created customer","Success":"true","CustomerID":"1212"}}}
感谢您的提前帮助。首先,您可以使用以下方法将字符串解码为数组,并将此数组转换为XML: 例如:
$data = array(
'post' => array(
'id' => 1,
'title' => 'Best post',
'body' => ' ... '
)
);
$xml = Xml::build($data);