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.
精彩评论