代码在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
<?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
解决方案 »
- mysqli_connect和mysql_connect的区别
- 连接远程mysql问题 急
- 关于if语句是否有like的效果
- file_get_contents('网址'),得到的页面大小为Okb
- 求 支持火狐 ie 的导出表格数据到excel word的js代码
- 关于文章插入数据库前转义的问题
- 字符串最后一个字符是什么?
- 求上傳圖片的php程序,在線等待
- 请推荐一个比较好的主页空间
- 请教孟兄,鸟儿兄,梅花雨,秋水无恨等众位高手两个问题:1.XML文件中能否载入PHP文件,以及如何载入,请指教.2.请高手帮忙:看看这段程序,问题
- smarty的问题,输出运算结果
- Apache无法loadXML
header("Content-Type: text/plain");
到
header("Content-Type: application/xml");
是否你的Linux没有安装日文字符集,
是否你的Linux没有安装日文字符集, 同意 6 楼