array(3) { ["user"]=> string(8) "customer" ["password"]=> string("/> array(3) { ["user"]=> string(8) "customer" ["password"]=> string(">
Heim >Backend-Entwicklung >PHP-Tutorial > 多维PHP数组怎么转换成xml格式的数据
多维PHP数组如何转换成xml格式的数据?
PHP数组是这样的:
array(4) <br /> { <br /> ["auth"]=> array(3) <br /> {<br /> ["user"]=> string(8) "customer" <br /> ["password"]=> string(8) "password" <br /> ["context"]=> string(1) "4" <br /> } <br /> ["owner"]=> array(2) <br /> { <br /> ["user"]=> string(9) "customer2" <br /> ["context"]=> string(1) "4" <br /> } <br /> ["language"]=> string(2) "en" <br /> ["task"]=> array(1) <br /> { <br /> ["code"]=> string(4) "0130" <br /> } <br /> }
<?xml version="1.0" encoding="utf-8"?><br /> <request><br /> <auth><br /> <user>customer</user><br /> <password>password</password><br /> <context>4</context><br /> </auth><br /> <owner><br /> <user>customer2</user><br /> <context>4</context><br /> </owner><br /> <language>en</language><br /> <task><br /> <code>0130</code><br /> </task><br /> </request>