1. $php_errormsg — 前一個錯誤信息
?php @strpos(); echo $php_errormsg; ?>
2.$http_response_header — HTTP 響應(yīng)頭
?php function get_contents() { file_get_contents("http://example.com"); var_dump($http_response_header); } get_contents(); var_dump($http_response_header); ?>
3. $argc — 傳遞給腳本的參數(shù)數(shù)目
?php var_dump($argc); ?> 當使用這個命令執(zhí)行: php script.php arg1 arg2 arg3
4. $argv — 傳遞給腳本的參數(shù)數(shù)組
?php var_dump($argv); ?> 當使用這個命令執(zhí)行:php script.php arg1 arg2 arg3
var_dump(__FILE__); //所在路徑文件名和文件名稱 E:\demo\blog_code\predefined\predefined.php var_dump(__DIR__); //所在完整目錄 E:\demo\blog_code\predefined var_dump(__LINE__); //代碼所在行號 4 class testClass{ function testMethod(){ var_dump(__FUNCTION__); //返回當前方法名 testMethod var_dump(__CLASS__); //返回類名 testClass var_dump(__METHOD__); //類名加方法名 testClass::testMethod } } $a=new testClass(); $a->testMethod();