Home > Backend Development > PHP Tutorial > 请教一个关于include的问题

请教一个关于include的问题

WBOY
Release: 2016-06-23 14:05:40
Original
897 people have browsed it

比如,我有一个common.php文件,里面内容是
if(extension_loaded('zlib')){ob_start('ob_gzhandler');}

if(extension_loaded('zlib')){ob_end_flush();}
?>

这个是开启zlib的一段代码,第一句是开启,最后一句是结束,我想把他插入到index.php里,因为index.php里还有一些代码,如何能自动将第一句插入到页首,最后一句插入到页尾,这个用include可以吗,具体操作是什么,谢谢。


回复讨论(解决方案)

分两个文件,把初始化的部分放入header,最后输出放入footer。

分别在第一行和最后include

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template