PHP error_log() 函數(shù)
2017-08-05 PHP error_log() 函數(shù) PHP Error 和 Logging 函數(shù) 實(shí)例 把錯(cuò)誤消息發(fā)送到 web 服務(wù)器日志和郵件賬號(hào): ?php // 如果錯(cuò)誤連接至數(shù)據(jù)庫(kù),則向服務(wù)器日志發(fā)送錯(cuò)誤消息 if (!mysqli_connect(localhost,bad_use
PHP error_get_last() 函數(shù)
2017-08-05 PHP error_get_last() 函數(shù) PHP Error 和 Logging 函數(shù) Example 返回最后發(fā)生的錯(cuò)誤: ?php echo $test; print_r( error_get_last() ); ? 以上代碼的輸出類(lèi)似這樣: Array ( [type] = 8 [message] = Undefined variable: test [fi
PHP debug_print_backtrace() 函數(shù)
2017-08-05 PHP debug_print_backtrace() 函數(shù) PHP Error 和 Logging 函數(shù) Example 打印一條 PHP 回溯: ?php function a($txt) { b(Glenn); } function b($txt) { c(Cleveland);} function c($txt) { debug_print_backtrace() ; } a(Peter); ? 以上代碼的
PHP debug_backtrace() 函數(shù)
2017-08-05 PHP debug_backtrace() 函數(shù) PHP Error 和 Logging 函數(shù) 實(shí)例 生成 PHP backtrace: ?php function a($txt) { b(Glenn); } function b($txt) { c(Cleveland);} function c($txt) { var_dump( debug_backtrace() ); } a(Peter); ? 以上代碼的輸出
PHP scandir() 函數(shù)
2017-08-05 PHP scandir() 函數(shù) PHP Directory 函數(shù) 實(shí)例 列出 images 目錄中的文件和目錄: ?php$dir = /images/; // 以升序排序 - 默認(rèn) $a = scandir($dir) ; // 以降序排序 $b = scandir($dir,1) ;print_r($a);print_r($b);? 結(jié)果:
PHP rewinddir() 函數(shù)
2017-08-05 PHP rewinddir() 函數(shù) PHP Directory 函數(shù) 實(shí)例 打開(kāi)一個(gè)目錄,列出其中的文件,重置目錄句柄,再次列出其中的文件,然后關(guān)閉: ?php$dir = /images/; // 打開(kāi)目錄,然后讀取其內(nèi)容 if (is_dir($dir)
PHP readdir() 函數(shù)
2017-08-05 PHP readdir() 函數(shù) PHP Directory 函數(shù) 實(shí)例 打開(kāi)一個(gè)目錄,讀取它的內(nèi)容,然后關(guān)閉: ?php$dir = /images/; // 打開(kāi)目錄,然后讀取其內(nèi)容 if (is_dir($dir)){ if ($dh = opendir($dir)){ while (($file = readdir($dh
PHP opendir() 函數(shù)
2017-08-05 PHP opendir() 函數(shù) PHP Directory 函數(shù) 實(shí)例 打開(kāi)一個(gè)目錄,讀取它的內(nèi)容,然后關(guān)閉: ?php$dir = /images/; // 打開(kāi)目錄,然后讀取其內(nèi)容 if (is_dir($dir)){ if ($dh = opendir($dir) ){ while (($file = readdir($d
PHP getcwd() 函數(shù)
2017-08-05 PHP getcwd() 函數(shù) PHP Directory 函數(shù) 實(shí)例 獲取當(dāng)前工作目錄: ?phpecho getcwd() ? 結(jié)果: /home/php 定義和用法 getchwd() 函數(shù)返回當(dāng)前工作目錄。 語(yǔ)法 getcwd(); 技術(shù)細(xì)節(jié) 返回值: 若成功則返回當(dāng)前
PHP dir() 函數(shù)
2017-08-05 PHP dir() 函數(shù) PHP Directory 函數(shù) 實(shí)例 使用 dir() 函數(shù): ?php$d = dir(getcwd()) ;echo Handle: . $d-handle . br;echo Path: . $d-path . br;while (($file = $d-read()) !== false){ echo filename: . $file . br;}$d-close();? 結(jié)果: H