array(3)  { ["user"]=> string(8) "customer"  ["password"]=> string(8)&nbs"/>  array(3)  { ["user"]=> string(8) "customer"  ["password"]=> string(8)&nbs">
Home > Backend Development > PHP Tutorial > 多维PHP数组怎么转换成xml格式的数据

多维PHP数组怎么转换成xml格式的数据

WBOY
Release: 2016-06-13 11:36:47
Original
1249 people have browsed it

多维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 />}
Copy after login


转换成xml格式后的数据格式是这样的:
<?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>
Copy after login
php数组 xml

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template