开发者

Removing blank output before opening tag to prevent "quirks" mode

I have a html template as a php string. To prevent output, all blank characters and line breaks before the html opening or doctype definition should be removed. What 开发者_JAVA百科is the simplest and fastest way to do this with PHP?


If I interpret your question as simply, "How do I remove whitespace from the beginning of a string", the answer is simply:

$str = trim($str);


If you are using some kind of MVC framework, you would find the output method in the view and trim the string.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜