When we heard the predefined PHP variables, we thought of $ _ POST, $ _ GET, $ _ SESSION, $ _ COOKIE, $ GLOBALS, in fact, there are several very useful predefined variables in PHP. We will now explain these common PHP pre-defined variables. When we heard the predefined PHP variables, we thought of $ _ POST, $ _ GET, $ _ SESSION, $ _ COOKIE, $ GLOBALS, in fact, there are several very useful predefined variables in PHP. We will now explain these common PHP pre-defined variables.
1. $ php_errormsg-previous error message
@ Strpos ();
Echo $ php_errormsg;
?>
2. $ http_response_header-HTTP response header
Function get_contents (){
File_get_contents ("http://example.com ");
Var_dump ($ http_response_header );
}
Get_contents ();
Var_dump ($ http_response_header );
?>
3. $ argc-number of parameters passed to the script
Var_dump ($ argc );
?>
Run the following command: php script. php arg1 arg2 arg3
4. $ argv-parameter array passed to the script
Var_dump ($ argv );
?>
Run the following command: php script. php arg1 arg2 arg3