首先在PHP,包括或解析中发生了什么?

Ita*_*vka 2 php performance

假设没有字节缓存.

my_func前A和B都包括在内,或之后进行解析?

$x=my_func();

//a.php and b.php are **very** heavy scripts
include ('a.php');
include ('b.php');


//my_func makes the browser use it's cached version of the page.
function my_func(){
  //send caching headers
  //header(....);
  exit;
}
Run Code Online (Sandbox Code Playgroud)

Ada*_*ght 10

是的,在执行包含之前将调用my_func.它们实际上是一种"运行时"机制,而不是解析时间.您甚至可以通过将它们包装在流量控制中来有条件地包含它们.