Home Backend Development PHP Tutorial PHP 2 debugging methods_PHP tutorial

PHP 2 debugging methods_PHP tutorial

Jul 13, 2016 pm 05:45 PM
dump echo export php print var method Browser use debug output

1. Use echo, print, print_r, var_export or var_dump to directly output to the browser
In this case, there is no interruption or jump in the middle of the page, and is usually followed by exit.
After the project is officially launched, should these debugging codes be removed or added with comments? If not removed, it will appear that there are too many junk codes and there may be minor performance issues.
2. Write the value of the variable to be output to the file
In this case, PHP network functions are generally used to implement Socket links, such as any connections established through fopen(), fsockopen() and pfsockopen().
The most applicable place for this debugging method is that the request does not come from the browser, but from the client software (Appendix L. List of supported protocols/encapsulated protocols), especially during the development and debugging phase. If there are no logs, the program will be almost Unable to debug (because the program is called by the client and has no interface, so debugging using echo is not possible at this time)

For example, ucenter integrates third-party PHP applications, and ucenter establishes connections to multiple applications. We only need to write the file with the $get variable in the third-party PHP application uc.php, and then read the file, and then we can know the data sent by ucenter to each application. action, id and other data.
php writes array to file
$file=”./data/log.txt”;
$array = array(“count” => “3000″, “num” => “300″);
file_put_contents($file,serialize($array));//Write cache
?>

Author "danbaise"

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478643.htmlTechArticle1. Use echo, print, print_r, var_export or var_dump to directly output to the browser. In this case, in the middle of the page There are no interruptions or jumps, usually followed by exit. After the project is officially launched...
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 Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Hot Topics

Java Tutorial
1677
14
PHP Tutorial
1280
29
C# Tutorial
1257
24
How to see how much money you make in Anbi?_How to view transaction income on Anbi platform How to see how much money you make in Anbi?_How to view transaction income on Anbi platform May 14, 2025 pm 07:24 PM

Binance is a blockchain project focused on decentralized infrastructure, where users can earn money by participating in staking and other activities. This article will introduce in detail how to view your trading income and the overall amount earned on the Ancoin platform.

What is Sign Protocol (SIGN)? Guide to getting started with cross-chain verification networks What is Sign Protocol (SIGN)? Guide to getting started with cross-chain verification networks May 14, 2025 pm 10:48 PM

Blockchain technology continues to change the way people exchange value, verify information and build trust online. As decentralized applications flourish in various industries, the ability to confirm statements and identities across multiple blockchains has become increasingly important and complex. Traditional trust models that rely on centralized authority are often insufficient to support a decentralized ecosystem, so the demand for blockchain native verification solutions is also growing. SignProtocol (SIGN) addresses this challenge by providing a framework for creating, verifying, and managing proofs across multiple blockchain networks. SignProtocol aims to create a full chain

okx official website mobile web version okx official website entrance address okx official website mobile web version okx official website entrance address May 14, 2025 pm 08:06 PM

It is very simple to access the OKX official website through the mobile web version. Just open your mobile browser, enter www.okx.com, and wait for the page to load. After logging in, you can conduct transactions and view account information to ensure the use of strong passwords and dual-factor authentication to ensure security.

How to sell Bitcoins in your hand? Tutorial on selling Bitcoin on Huobi huobi exchange How to sell Bitcoins in your hand? Tutorial on selling Bitcoin on Huobi huobi exchange May 14, 2025 pm 07:33 PM

If you hold Bitcoin and want to sell it through Huobi Huobi Exchange, this article will explain in detail how to complete this process step by step. Huobi Huobi is a world-renowned cryptocurrency trading platform that provides a safe and convenient trading environment. The following are detailed operation tutorials to help you sell Bitcoin smoothly.

Anbi official website mobile web version Anbi official website entrance address Anbi official website mobile web version Anbi official website entrance address May 14, 2025 pm 08:15 PM

The entrance address of Ancoin official website mobile web version is www.anc-coin.com. The access steps include: 1. Open the mobile browser; 2. Enter www.anc-coin.com; 3. Enter the official website. This web version supports all mainstream browsers, provides functions such as account management, transaction operations, information browsing and customer service support, and uses SSL encryption and two-factor authentication to ensure security.

What are the free market websites in the currency circle? A complete list of free market websites What are the free market websites in the currency circle? A complete list of free market websites May 14, 2025 pm 09:45 PM

Websites that can watch the market in the currency circle for free include Binance, Ouyi, Gate.io, Huobi, CoinMarketCap, CoinGecko and TradingView. 1. Visit each website, 2. Enter the market page, 3. Select cryptocurrency, 4. View detailed market data and analysis tools. These websites provide real-time data and market viewing services for multiple cryptocurrencies.

Huobi Exchange web version registration portal Huobi Exchange web version registration portal May 14, 2025 pm 07:12 PM

The steps to register through the Huobi Exchange web version are as follows: 1. Visit www.huobi.com and click the "Register" button in the upper right corner. 2. Fill in the email, set the password, select the country/region, and click "Next". 3. Verify the email and click the link in the email. 4. Enter the mobile phone number, receive and enter the verification code, and click "Verify". 5. After completing all the steps, you can register successfully.

Ouyi platform registration test: 10-minute minimalist tutorial, with invitation code to get free benefits Ouyi platform registration test: 10-minute minimalist tutorial, with invitation code to get free benefits May 14, 2025 pm 06:54 PM

As a highly anticipated digital currency trading platform, Ouyi platform has attracted the attention and use of a large number of users. Whether you are a novice or a veteran, you can trade cryptocurrencies through this platform. This article will introduce in detail how to register on the Ouyi platform and provide an invitation code to allow you to enjoy additional benefits. The entire process will be completed in 10 minutes, allowing you to get started quickly.

See all articles