1. $php_errormsg — 前一個(gè)錯(cuò)誤信息
<?php@strpos();echo $php_errormsg;?>
2.$http_response_header — HTTP 響應(yīng)頭
<?phpfunction get_contents() { file_get_contents("http://example.com"); var_dump($http_response_header);}get_contents();var_dump($http_response_header);?>3. $argc — 傳遞給腳本的參數(shù)數(shù)目
<?phpvar_dump($argc);?>當(dāng)使用這個(gè)命令執(zhí)行: php script.php arg1 arg2 arg3
4. $argv — 傳遞給腳本的參數(shù)數(shù)組
<?phpvar_dump($argv);?>當(dāng)使用這個(gè)命令執(zhí)行:php script.php arg1 arg2 arg3
var_dump(__FILE__); //所在路徑文件名和文件名稱 E:/demo/blog_code/predefined/predefined.phpvar_dump(__DIR__); //所在完整目錄 E:/demo/blog_code/predefinedvar_dump(__LINE__); //代碼所在行號(hào) 4class testClass{ function testMethod(){ var_dump(__FUNCTION__); //返回當(dāng)前方法名 testMethod var_dump(__CLASS__); //返回類名 testClass var_dump(__METHOD__); //類名加方法名 testClass::testMethod }} $a=new testClass();$a->testMethod(); 新聞熱點(diǎn)
疑難解答
圖片精選