Home Backend Development PHP Tutorial Usage of the php debugging tool debug_print_backtrace() function

Usage of the php debugging tool debug_print_backtrace() function

Jul 10, 2017 pm 02:19 PM
debug print

debug_print_backtrace() is a very low-key function, few people pay attention to it. But when I call another object on an object and then call other objects and a function in the file and an error occurs, it is laughing.

If we Want to know who called a certain method? debug_print_backtrace can solve it
debug_print_backtrace() can print out the calling process of a page, and it is clear where it comes from.
But this is a proprietary function of PHP5, okay There is already an implementation in pear,
http://pear.php.net/package/PHP_Compat

Test code, The code is as follows:

<?php 
class a{ 
function say($msg) { 
echo "msg:".$msg; 
echo "<pre class="brush:php;toolbar:false">";debug_print_backtrace(); 
} 
} 

class b { 
function say($msg) { 
$a = new a(); 
$a->say($msg); 
} 
} 

class c { 
function construct($msg) { 
$b = new b(); 
$b->say($msg); 
} 
} 

$c = new c("test");
Copy after login

Output The result

code is as follows:

msg:test 
#0 a->say(test) called at [/var/www/test/test0723.php:12] 
#1 b->say(test) called at [/var/www/test/test0723.php:19] 
#2 c->construct(test) called at [/var/www/test/test0723.php:23]
Copy after login

The above is the detailed content of Usage of the php debugging tool debug_print_backtrace() function. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem of invalid debugging when setting breakpoints in SpringBoot project How to solve the problem of invalid debugging when setting breakpoints in SpringBoot project May 11, 2023 am 10:49 AM

I am new to the springboot project. (1) I found that breakpoint debugging was ineffective. I was very depressed and searched for solutions online. All I saw were some very complicated solutions, which were said to be remote debugging, but also required additional opening slogans. This is different from a traditional project, so I don’t think it’s necessary. So after some exploration, I found that there is a simpler way. The steps are as follows: Add a configuration in the plugin part of the pom file: false and it will be ok; (2) Regarding the error in the SpringBoot project that the web.xml file is missing, because Traditional web projects require web.xml files, but SpringBoot projects do not require web.xml files.

Take you to debug Nestjs project in VSCode (tutorial) Take you to debug Nestjs project in VSCode (tutorial) Apr 24, 2023 pm 05:53 PM

Friends who have used Vscode to write projects such as Node all know that if we want to troubleshoot a problem, we mostly print it through console.log to see where the problem is. If the problem involved is more complex, we will choose Through Vscode...

Where is print on the keyboard? Where is print on the keyboard? Jun 19, 2023 am 09:37 AM

The printscreen key is on the arrow keys of the keyboard device, with the words "prtsc sysrq" on it, and is located to the right of f12. If there is no button with the word "prtsc sysrq", you can find "fn" and "insert(prt sc)", click "fn" first, and then click "insert(PRT sc)" to realize the printscreen screenshot function.

How to use IDEA remote connection Debug in springboot How to use IDEA remote connection Debug in springboot May 10, 2023 pm 11:55 PM

1. First create a Demo ready for remote debugging. Pay attention to the configuration of the build project 4.0.0org.springframework.bootspring-boot-starter-parent2.1.4.RELEASEcom.remote.testremote_test0.0.1-SNAPSHOTremote_testDemoprojectforSpringBoot1.8org.springframework.bootspring-boot- starterorg.springframework.bootspring-bo

How to effectively deal with overflow problems How to effectively deal with overflow problems Jan 27, 2024 am 09:39 AM

How to Correctly Deal with Overflow Problems Overflow is a common computer programming problem, especially when dealing with numbers or arrays. Overflow occurs when we try to store a value that exceeds the allowed range of the data type. The key to solving this problem lies in correctly handling and validating data boundaries. Several common overflow problems and corresponding solutions will be introduced below. Integer overflow Integer overflow means that during calculation, the result exceeds the representation range of the integer type. For example, in the 32-bit signed integer type in

UCIe 2.0: Advancing the open chiplet ecosystem with 3D packaging and manageability UCIe 2.0: Advancing the open chiplet ecosystem with 3D packaging and manageability Aug 08, 2024 pm 12:51 PM

The Universal Chiplet Interconnect Express (UCIe) Consortium has announced the release of the UCIe 2.0 specification, further advancing the open chiplet ecosystem. The latest specification introduces several key enhancements. First, it adds support f

How to use Nocalhost and enable debugging in Python How to use Nocalhost and enable debugging in Python May 14, 2023 pm 03:16 PM

Nocalhost is a developer tool that supports debugging and deployment of Kubernetes applications. Using Nocalhost for Python development requires completing the following steps: Install Nocalhost CLI. It can be installed through the installation package provided by Nocalhost official website. Configure the Kubernetes cluster and install the Nocalhost plugin. You can refer to the guidance provided in Nocalhost official documentation. Install the Python interpreter and debugger on the local computer, such as Python's own pdb or third-party libraries pudb, ipdb, etc. Create a Python project and add the debugger calling statement to the code,

Introduction to Python functions: functions and usage examples of the print function Introduction to Python functions: functions and usage examples of the print function Nov 03, 2023 pm 04:33 PM

Python is a popular programming language designed to make computer programming simpler and easier to understand. In Python, using the print function to output text to the console is a basic task. In this article, we'll introduce Python's print function, explore its capabilities and usage examples, and provide code examples to help you better understand how to use the function. Python's print function is a built-in function used to output text and the value of a variable. Its syntax is very simple. You just need to

See all articles