編集xmlの「ヘッダ」に
をエンコーディングを追加する方法を
は今、「ヘッダーは」次のようになります。
<?xml version="1.0"?>
どのようにすることができますSimpleXMLをを使用した場合PHPで "ヘッダ"にエンコーディングを追加しますか?
私のXMLクラス:
class XML {
private $root = '<response />';
function __construct($root=null){
$this->root = new SimpleXMLElement($root ? $root:$this->root);
}
function encode($arr, $node=null){
$node = $node == null ? $this->root:$node;
foreach($arr as $key => $value){
if(is_array($value)){
$this->encode($value, $node->addChild($key));
}
else{
$node->addChild($key, $value);
}
}
}
function output(){
return $this->root->asXML();
}
}
あなたが取得しているエラーは何ですか? – jerluc
私の質問にしてください – clarkk