本篇文章為大家展示了PHP中怎么實(shí)現(xiàn)預(yù)定義變量,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
1. $php_errormsg — 前一個(gè)錯(cuò)誤信息
2.$http_response_header — HTTP 響應(yīng)頭
3. $argc — 傳遞給腳本的參數(shù)數(shù)目
當(dāng)使用這個(gè)命令執(zhí)行: php script.php arg1 arg2 arg3
4. $argv — 傳遞給腳本的參數(shù)數(shù)組
當(dāng)使用這個(gè)命令執(zhí)行:php script.php arg1 arg2 arg3
__FILE__:返回所在路徑文件名和文件名稱
__DIR__:返回文件所在的完整目錄
__LINE__:返回當(dāng)前文件代碼的行號
__CLASS__:返回當(dāng)前類名
__FUNCTION__:返回當(dāng)前方法名
__METHOD__:返回當(dāng)前類名和方法名
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__); //返回當(dāng)前方法名 testMethod var_dump(__CLASS__); //返回類名 testClass var_dump(__METHOD__); //類名加方法名 testClass::testMethod } } $a=new testClass(); $a->testMethod();
上述內(nèi)容就是PHP中怎么實(shí)現(xiàn)預(yù)定義變量,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。