开发者

What is the best way to catch extraneous output with PHP?

开发者 https://www.devze.com 2023-02-10 19:52 出处:网络
I am building a site and for the life of me can not tell how this character (shows Unicode symbol for invalid codepoint) is being prepended to some (articles) of my pages (before the doctype).

I am building a site and for the life of me can not tell how this character (shows Unicode symbol for invalid codepoint) is being prepended to some (articles) of my pages (before the doctype).

I have searched through the site's program flow and haven't found anything. Ther开发者_Go百科e is only one echo, which echoes the request's response after sending headers.

I am using Kohana 3, but I don't think it is too relevant to what I am asking (I've worked with Kohana for years and never had this, I doubt it is framework related).

I have looked at all PHP files included in my application/ folder, and they appear to be normal.

The Request::instance()->execute() is where the output is originating from in my bootstrap.php (wrapping the call with echos proved this). The articles.php controller has no output, and either does the model or parent controller.

What methods can I use to find this output?


I turned on Show Invisible Characters in my IDE (Coda) and saw this lovely, eh, red thing.

What is the best way to catch extraneous output with PHP?

I used trusty backspace, and now it is gone! :D

I have no idea how it got there...


I suspect that might be the pesky byte-order mark (as deceze says in his comment). Try saving your PHP scripts as UTF-8 without BOM and see if it helps. If you are seeing the unknown-code-point symbol that could have something to do with your pages being served as ISO-8859-1 instead of UTF-8 as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消