leoxqing 发表于 2012-07-18 10:43

xml数据创建无法显示

<?php

$doc = new DOMDocument('1.0');
// we want a nice output
$doc->formatOutput = true;

$root = $doc->createElement('book');
$root = $doc->appendChild($root);

$title = $doc->createElement('title');
$title = $root->appendChild($title);

$text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);

echo "Saving all the document:\n";
echo $doc->saveXML() . "\n";

echo "Saving only the title part:\n";
echo $doc->saveXML($title);

?>

echo 出来没有XML文件显示.

imbiss 发表于 2012-07-18 14:33

1 把你那些乱七八糟的echo输出去掉
2 添加合适的头信息
3 参看输出的页面源码
4 使用var_dump 调试变量


maochanglu 发表于 2012-07-19 09:31

echo输出去掉

yifangyou 发表于 2012-07-22 12:17

没有在header声明为xml
在第一行里加一下error_reporting(0);
header('Content-type: Application/msexcel');
页: [1]
查看完整版本: xml数据创建无法显示