代码在windows下正常,但在linux下报错
<?php
mb_internal_encoding("Shift_JIS");//テストデータ
$com = new StdClass;$com->label = "あいうえお";
$author = "著者";
$text = "テキストXMLテスト";
$c_author = "五十音図";
// XMLの作成
$dom = new DOMDocument('1.0','Shift_JIS');header("Content-Type: text/plain");$item = $dom->appendChild($dom->createElement('item'));
$title = $item->appendChild($dom->createElement('title'));
$title->appendChild($dom->createtextNode($com->label));
$auth = $item->appendChild($dom->createElement('author'));
$auth->appendChild($dom->createtextNode($author));
$comment = $item->appendChild($dom->createElement('comment'));
$c_auth = $comment->appendChild($dom->createElement('c_author'));
$c_auth->appendChild($dom->createtextNode($c_author));
$c_text = $comment->appendChild($dom->createElement('c_message'));
$c_text->appendChild($dom->createtextNode($text));// 出力
echo $dom->saveXML();----------------------------
DOMDocument::saveXML() unkown encoding Shift_JIS

解决方案 »

  1.   

    linux不支持日语???改成utf-8试试
      

  2.   

    utf-8是可以的,不过希望用shift_jis,又解决方法吗?
      

  3.   

    不鸟解了,我都是用IIS+ISAPI来搞php的。嘿嘿
      

  4.   

    修改
    header("Content-Type: text/plain"); 

    header("Content-Type: application/xml");
      

  5.   

    在我的机器上运行OK,
    是否你的Linux没有安装日文字符集,
      

  6.   

    在我的机器上运行OK, 
    是否你的Linux没有安装日文字符集, 同意 6 楼
      

  7.   

    locale -m 里面有SJIS,$dom = new DOMDocument('1.0','SJIS'); 还是报DOMDocument::saveXML() unkown encoding SJIS