欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

关于PHP输出XML文件的有关问题

程序员文章站 2022-06-07 22:30:10
...
关于PHP输出XML文件的问题
PHP each出xml内容在浏览器上会自动将xml标签隐藏掉

于是我加入了header("Content-type: text/xml");

但是问题出现了,不加入前输出的内容是正常的(查看网页源文件),但是一旦加入header后内容只输出一部分就卡住不输出了

如下:
正常的情况:
?我是猪我是猪我是猪我是猪我是猪我是猪我是猪我是猪

加入header后:
我是猪我是猪我是猪我是<br><br>内容就卡住了<br><br><font color="#e78608">------解决方案--------------------</font><br> 会不会是你的笔记本上的php环境和服务器上的不一致啊!检查下吧! <div class="clear"> <a href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2suaHRtbD90PTI=" target="_blank" rel="nofollow"><img onerror="this.src='/statics/superweb999/images/image_error.jpg'"src="/default/index/img?u=aHR0cHM6Ly9pbWcucGhwLmNuL3VwbG9hZC9jb3Vyc2UvMDAwLzAwMC8wNzEvNjIwYzYwNGY3NTI1MTk5NS5wbmc=" style="margin-top: 30px;" alt="关于PHP输出XML文件的有关问题" title="关于PHP输出XML文件的有关问题"></a><p style="float:right;font-size:13px;color:#999;"><span class="red">声明:</span>本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。</p> </div> <p class="article-relative-header">相关文章</p> <p class="article-relative-header">相关视频</p> <hr class="layui-clear"> <ul class="article-relative-ul"> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy00ODg5MTkuaHRtbA==" target="_blank" rel="nofollow">教你使用PHP数据库迁移工具“Phinx”</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy00ODg4ODkuaHRtbA==" target="_blank" rel="nofollow">详解win10下PHP的安装配置(以php5.6为...</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy00ODg4MzUuaHRtbA==" target="_blank" rel="nofollow">php Swoole实现毫秒定时计划任务(详解)</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy01MTUzNy5odG1s" target="_blank" rel="nofollow">PHP+redis实现添加处理投票的方法_PHP</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0yMjAzNTguaHRtbA==" target="_blank" rel="nofollow"> 关于PHP输出XML文件的有关问题 </a> </li> </ul> <ul class="article-relative-ul"> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNDk2Lmh0bWw=" target="_blank" title="HTML基础教程之<strong>和<em>" rel="nofollow">HTML基础教程之<strong>和<em></a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNTAwLmh0bWw=" target="_blank" title="HTML基础教程之<span>标签" rel="nofollow">HTML基础教程之<span>标签</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNTI4Lmh0bWw=" target="_blank" title="HTML基础教程之<meta>标签" rel="nofollow">HTML基础教程之<meta>标签</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNjc5Lmh0bWw=" target="_blank" title="HTML <div> 和<span>" rel="nofollow">HTML <div> 和<span></a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvODUwLmh0bWw=" target="_blank" title="JavaScript数组对象属性length和二维数组" rel="nofollow">JavaScript数组对象属性length和二维数组</a> </li> </ul>