如何在php代码中编写xml代码 [英] how to write xml code in php code

查看:87
本文介绍了如何在php代码中编写xml代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在rss.php中写了这些代码



 <?  php   

header('Content-Type: text / xml');

echo <?xml 版本 = \ 1.0 \ < span class =code-summarycomment> encoding = \ utf-8 \ > \\\
;
?>

< rss > ;
< channel >
< title > 我的简单博客< / title >
< link > http:// localhost:1234 / simple_blog / < / link >
< desctiption > 此博客非常棒。 < / desctiption >
< 语言 > zh -us < / language >
< / channel >
< / rss >







结果:

此XML 文件    具有 相关联的任何样式信息。文档树 如下所示。





如何解决?

解决方案

无所事事......如果你只看到这个错误,我的工作没有任何问题。



你在哪个浏览器中收到此错误?



Chrome内置了RSS查看器。查看此Chrome扩展程序以查看RSS,https:/ /chrome.google.com/webstore/detail/nlbjncdgjeocebhnmkbbbdekmmmcbfjd

I wrote that codes in rss.php

<?php

header('Content-Type: text/xml');

echo "<?xml version = \"1.0\" encoding = \"utf-8\" ?>\n";
?>

<rss>
    <channel>
        <title> My Simple Blog</title>
        <link> http://localhost:1234/simple_blog/ </link>
        <desctiption> This blog is awesome. </desctiption>
        <language> en-us </language>
    </channel>
</rss>




Result:

This XML file does not appear to have any style information associated with it. The document tree is shown below.



How fix it?

解决方案

Nothing to do ... Ir working without any issues if you are seeing only this error.

And in which browser you are getting this error ?

Chrome doesn''t have an RSS viewer built in. Check out this chrome extension to view RSS, https://chrome.google.com/webstore/detail/nlbjncdgjeocebhnmkbbbdekmmmcbfjd


这篇关于如何在php代码中编写xml代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆