我有以下PHP代码。如何编辑它以导出到XML? 请帮帮我,我是新手..
<?php
$koneksi=mysql_connect("localhost","root","");
mysql_select_db("abdrahmat",$koneksi);
$id=77;
$nmtabel="artikel";
$sql=mysql_query("SELECT * FROM $nmtabel where id_artikel='$id'");
$r=mysql_fetch_array($sql);// JavaScript Document
答案 0 :(得分:0)
试试这个:
$array = json_decode(json_encode($r), true);
$xml = new SimpleXMLElement('<root/>');
$importer = $createArrayImporter($xml);
echo simplexml_pretty_print($importer($array));