PHP堆棧調(diào)試操作簡單示例
本文實例講述了PHP堆棧調(diào)試操作。分享給大家供大家參考,具體如下:
你是否想知道當(dāng)前函數(shù)被哪些文件調(diào)用了,如果知道了這些路徑,我們就能很好的理解程序的執(zhí)行過程,這是非常重要的,也是了解別人程序的基礎(chǔ),那么這里我就給大家介紹一種php中的堆棧調(diào)試的方法,其實就是php內(nèi)置的一個函數(shù)debug_backtrace()
;
下面是就稍微介紹一下吧,具體還是要看手冊哦,喜歡看手冊的程序員才是前途無量的
$statcks = debug_backtrace(); $tmp_arr = array(); if(!$stacks) return $tmp_arr; foreach($stacks as $k=>$v) { $tmp[$k]['file'] = isset($v['file']) ? $v['file'] : '--'; $tmp[$k]['line'] = isset($v['line'])? $v['line'] : '--'; $tmp[$k]['function'] = isset($v['function']) ? $v['function'] : '--'; }
運行結(jié)果:
Array
(
[0] => Array
(
[file] => D:\wwwroot\CodeIgniter\application\controllers\finance\channel.php
[line] => 128
[function] => get_total_rows
)
[1] => Array
(
[file] => --
[line] => --
[function] => index
)
[2] => Array
(
[file] => D:\wwwroot\CodeIgniter\application\controllers\finance\channel.php
[line] => 46
[function] => call_user_func
)
[3] => Array
(
[file] => --
[line] => --
[function] => get_nav
)
[4] => Array
(
[file] => D:\wwwroot\CodeIgniter\system\core\CodeIgniter.php
[line] => 360
[function] => call_user_func_array
)
[5] => Array
(
[file] => D:\wwwroot\CodeIgniter\index.php
[line] => 205
[function] => require_once
)
)
這里是打印出來的數(shù)組,非常的好了
更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《PHP錯誤與異常處理方法總結(jié)》、《php字符串(string)用法總結(jié)》、《PHP數(shù)組(Array)操作技巧大全》、《PHP運算與運算符用法總結(jié)》、《PHP網(wǎng)絡(luò)編程技巧總結(jié)》、《PHP基本語法入門教程》、《php面向?qū)ο蟪绦蛟O(shè)計入門教程》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》
希望本文所述對大家PHP程序設(shè)計有所幫助。
- PHP 調(diào)試工具Debug Tools
- PHPStorm+XDebug進行調(diào)試圖文教程
- 解析phpstorm + xdebug 遠程斷點調(diào)試
- 調(diào)試PHP程序的多種方法介紹
- php 調(diào)試利器debug_print_backtrace()
- FirePHP 推薦一款PHP調(diào)試工具
- 在WAMP環(huán)境下搭建ZendDebugger php調(diào)試工具的方法
- php 服務(wù)器調(diào)試 Zend Debugger 的安裝教程
- PHP調(diào)試函數(shù)和日志記錄函數(shù)分享
- php Xdebug 調(diào)試擴展的安裝與使用.
相關(guān)文章
php文件打包 下載之使用PHP自帶的ZipArchive壓縮文件并下載打包好的文件
php文件打包 下載之使用PHP自帶的ZipArchive壓縮文件并下載打包好的文件2012-06-06PHP實現(xiàn)將科學(xué)計數(shù)法轉(zhuǎn)換為原始數(shù)字字符串的方法
這篇文章主要介紹了PHP實現(xiàn)將科學(xué)計數(shù)法轉(zhuǎn)換為原始數(shù)字字符串的方法,通過一個簡單的自定義函數(shù)使用正則替換實現(xiàn)該功能,是非常實用的技巧,需要的朋友可以參考下2014-12-12PHP curl模擬瀏覽器采集阿里巴巴的實現(xiàn)代碼
都說阿里巴巴有不能采集和防采集的神話,今天就用張老師講的Curl采集寫了一個模擬瀏覽器的代碼。2011-04-04詳解PHP版本兼容之openssl調(diào)用參數(shù)
這篇文章給大家分享了PHP版本兼容之openssl調(diào)用參數(shù)的詳細說明,有興趣的朋友參考學(xué)習(xí)下。2018-07-07php session_start()關(guān)于Cannot send session cache limiter - hea
在windows下編程,當(dāng)使用session_start()方法的時候,有時會報 session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/inpublisher/php1.php:1)這樣的錯誤2009-11-11