ວິທະຍາດິຈິກັບ() PHP
ຄວາມນິຍົມ
ຈະສ້າງ backtrace PHP:
<?php function a($txt) { b("Glenn"); } function b($txt) { c("Cleveland"); } function c($txt) { var_dump(debug_backtrace()); } a("Peter"); ?>
ຄຳອອກຂອງວິທະຍາດັ່ງກ່າວຈະຄືກັນດຽວກັນ:
Array ( [0] => Array ( [file] => C:\webfolder\test.php [line] => 6 [function] => c [args] => Array ( [0] => Cleveland ) ) [1] => Array ( [file] => C:\webfolder\test.php [line] => 3 [function] => b [args] => Array ( [0] => Glenn ) ) [2] => Array ( [file] => C:\webfolder\test.php [line] => 11 [function] => a [args] => Array ( [0] => Peter ) ) )
ການກໍານົດແລະການນໍາໃຊ້
ວິທະຍາດິຈິກັບ() ສ້າງ backtrace (ການກັບຄືນຕາມຕົ້ນຫຼັງ).
ຫຼັກສູດວິທະຍາດິຈິກັບ() ສະແດງວິທະຍາຂອງວິທະຍາດິຈິກັບ() ສະແດງຂໍ້ມູນທີ່ສ້າງຈາກວິທະຍາດິຈິກັບ() ວິທະຍາ.
ຫຼັງຈາກການອອກລະບົບສາຍວິທະຍາມີສາຍວິທະຍາຕ່າງໆທີ່ສາມາດຮັບມາໄດ້:
Name | Type | Description |
---|---|---|
function | string | Current function name |
line | integer | Current line number |
file | string | Current file name |
class | string | Current class name |
ວັດຖຸ | ວັດຖຸ | Current object |
type | string |
Current call type. Possible calls:
|
args | array | If in a function, list function parameters. If in a referenced file, list the name of the referenced file. |
Syntax
debug_backtrace(options,limit);
Parameter | Description |
---|---|
options |
Optional. Specify the bitmask for the following options:
|
limit | Optional. Limit the number of stack frames returned. Default is (limit=0) , return all stack frames. |
Technical Details
Return Value: | None |
---|---|
PHP Version: | 4.3+ |
PHP Update Log |
PHP 5.4: ໄດ້ເພີ່ມຄຳປະໝາດຄຳຂັດແຍກ limit. PHP 5.3.6: ຄຳປະໝາດ provide_object ເປັນ optionsແລະໄດ້ເພີ່ມຄຳປະໝາດ DEBUG_BACKTRACE_IGNORE_ARGS. PHP 5.2.5: ໄດ້ເພີ່ມຄຳປະໝາດຄຳຂັດແຍກ provide_object. PHP 5.1.1: ໄດ້ເພີ່ມຄືນປັດຈຸບັນ ວັດຖຸ ສິ່ງທີ່ອາດກັບຄືນ |