How do I stop ZF from sending a empty character at the beginning?

我与影子孤独终老i 提交于 2019-12-02 03:40:41

You probably have saved your PHP files encoded as UTF-8 with a Byte Order Mark (BOM). Try saving your PHP files encoded as UTF-8 without a BOM. Advanced text-editors such as Notepad++ on Windows, or TextWrangler on Mac OS, or most other advanced text-editors have such a feature.

Another possibility is that you have unintentional whitespace characters before the any <?php in your PHP files, for instance in this example of a single PHP file:

 <-- here for instance
<?php
  /*
    some code to generate $yourXml;
  */
?>
 <-- or here
<?php
  echo $yourXml;
?>

...or other unintentional whitespace characters outputted by your PHP code.

If you've taken care of these sorts of problems, then there is no need for output buffering. Using output buffering as a means to circumvent these types of problems is a sloppy coding habit.

edit:
Nor would it probably solve the problem, come to think of it.

echo trim($yourXml); 

you can simpy do this :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!