我正在尝试将 a 转换为在 phparray
中xml
使用 ajson
json
andarray
工作正常,但是当我尝试将其转换为时,array
我xml
不断收到错误消息。
Call to undefined function array_to_xml()
这是json
{"host":"127.0.0.1","username":"root","password":"something","dbname":"something","table":"something"}
Json到`数组
$json = json_decode(file_get_contents('something.json'), true);
$info = array(
$json['host'],
$json['username'],
$json['password'],
$json['dbname'],
);
数组到 xml
simplexml_load_string(array_to_xml($json, new SimpleXMLElement('<connection/>'))->asXML()) or die("can't read");