是服务器编译的if语句中的include语句


Are include statments that are within if statements compiled by the server?

我正在尝试减少index.php的加载时间。将我的if {code}语句减少到if {include}会减少加载时间吗?还是全部包含编译?

//old code:
<?php
if (isset($_get("about")){
    my_sql code...;
    echo about me code...;
?>
//new code:
<?php
if (isset($_get("about")){
    include "./include/about.php";
?>

只有在if条件为true时才会包含include。这是否真的加速了编译是值得怀疑的,因为打开和读取另一个文件可能会抵消通过编译更少代码而获得的任何速度。只有当代码更易于阅读和维护时,才应该将代码分离成单独的文件。为了提高速度,请使用操作码缓存。