开发者

Where to put DTD in gzipped files?

I'm adding the following:

<?php ob_start( 'ob_gzhandler' ); ?>

To a file to enable gzip compression.

Should it go before the DTD, or between it and the <html>开发者_如何学运维; tag?


Before all data sent to browser ^^


It has to go before the DTD and any other output. The < of <?php must be the absolute first byte of the file otherwise there is literal output before it (even if that's only whitespace, or a UTF-8 fake-BOM emitted by a misguided Windows text editor).

Any <!DOCTYPE> declaration in a .php file is just pure output text, something that applies to the returned HTML page and not the PHP file itself (as PHP is neither HTML nor XML).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜