FunctionsendHeader ($ num, $ rtarrnull) {static $ sapinull; if ($ sapinull) {$ sapiphp_sapi_name () ;}return $ sapi ++; setHeader () is found when PW source code is read () use stati...
Function sendHeader ($ num, $ rtarr = null ){
Static $ sapi = null;
If ($ sapi === null ){
$ Sapi = php_sapi_name ();
}
Return $ sapi ++;
When reading the PW source code, I found that the setHeader () function uses the static keyword. it is strange that it has never been used before.
Static is used in the function. after a variable is declared, if this function is called again, it will continue at the initial value. for example, $ sapi will accumulate here.
Echo sendHeader (1 )."
";
Echo sendHeader (2 )."
";
Echo sendHeader (3 )."
";
Output:
Apache2handler
Apache2handles
Apache2handlet
It is a bit similar to global, but the difference is the scope. Static can only act on this function.
A little interesting. In-depth research is required.
From zaric