I found a good comrade who can debug PHP source code: PHP DEBUG TOOLS
Its project address: http://freshmeat.net/projects/php-debug-tools/
File download address: http:// freshmeat.net/urls/7c58ae3fecce5763e7546b958d36e082
It is currently version 1.03
The environment here is WINDOW XP, APACHE2.2, PHP5.2+ Zend Optimizer,
This is combined with PHP DEBUG TOOLS Help document to explain, some pictures are excerpted from the document.
1. Installation
Preparation environment before installation: X-Debug must be installed first,
As for how to install X-Debug, please see http://www.xdebug.org/docs/install
1. Download the appropriate X-DEBUG version from http://www.xdebug.org/download.php
2. Unzip the DLL file to the ext directory under the PHP installation directory, such as C:/php/ext/php_xdebug-2.0.4-5.2.8-nts.dll
3. Modify the php.ini file and add the following paragraph:
-- ----------I am the dividing line of perversion, you can't see me---------------------
zend_extension = "C:/php/ext/php_xdebug-2.0.4-5.2.8-nts.dll"
xdebug.collect_includes = Off
xdebug.default_enable = Off
xdebug.dump_globals = Off
xdebug.dump_once = Off
xdebug.extended_info = Off
-------------This is a perverted dividing line, you can’t see me------- ------------------
Note: This example is for non-thread safe version. For the thread safe version change "zend_extension" to "zend_extension_ts"
After the installation is complete, unzip all the files in the PHP DEBUG TOOLS compressed package to the website release directory.
(Assume the release directory is c:www, then create a new debug directory in it and throw all the files into it)
Enter in the browser: http://localhost/debug/test1-debug.php
If you see the picture below, the installation is successful.
2. Debugging
1.Debug errors
For example, the following code:
php
require './lib/debug.php';
function test($a, $b)
{
echo $asd;
}
test(10, ' abc');
?>

2. Use Debug() to debug
such as the following code:
require './lib/debug.php';
function test($args)
{
test_nested($args);
}
function test_nested($args)
{
debug($args);
// or: debug(get_defined_vars() );
// or: debug();
}
test(array('id'=>123, 'str'=>'test'));
?>

3. Use dump() or dump_tofile() to debug
such as the following code:
include_once './lib/dump.php';
function test5()
{
include './testdata/test0.php';
$test = array('int'=>1, 'float'=>2.0, 'float2'=>2.1);
dump($test, $_SERVER);
}
function test1() { test2(); }
function test2() { test3(); }
function test3() { test4() ; }
function test4() { test5(); }
test1();
?>

As for dump_tofile(), it is generally used in the following situations:
A. When you don’t want to stop the program running
B. It’s not that you don’t want to display the debugging data, but that you can’t. For example, when When you request status in AJAX.
C. You also want to debug in multiple places
Please refer to test7-dump_tofile.php in the debug directory
Note: I am running dump( ) or dump_tofile(), it is found that the

mentioned in the PHP DEBUG TOOL document does not appear. This can be corrected by modifying the code of debug/lib/debug.php. (Because dump_tofile() has been called dump(), so we only need to modify one place.
echo $pre at line 149;
is modified to:
//edit by benben--- start
echo '';
//edit by benben---end
Corrected picture:

4. Track the code, view System performance
You can browse test3-trace.php in the directory, and then click the console in the lower right corner.
For details, please refer to the documentation. (The documentation is in the doc directory in the compressed package)
3. How to integrate it with the project?
First, unzip the php debug tool file and place it in the project directory. Create a directory and call it debug! : )
Actually All we need is a few files.
For example, the path is: c:wwwprojectNamedebug
After that, we can debug in two ways
The first one is to add this sentence to the project source code :
include_once('./lib/debug.php');
For example: c:wwwprojectNamehellodebugindex.php
include_once('./debug/lib/debug.php');
$faint = 'helloworld ,debuging';
debug($arrb);
?>
What? You don’t want to write this sentence on every page?
Then look at the second one method,
There are two methods here,
1. Modify php.ini and add the following content (modify to your own directory):
auto_prepend_file = "c:wwwprojectNamedebugauto_prepend.php"
auto_append_file = "c:wwwprojectNamedebugauto_append.php"
2. Modify the .htaccess file (note: I have never tried this method, hehe)
php_value auto_prepend_file "c:wwwprojectNamedebugauto_prepend.php"
php_value auto_append_file "c :wwwprojectNamedebugauto_append.php"
This will facilitate the debugging of the entire project.
If it is AJAX development, there are still necessary places, please refer to the document for details. (Because I don’t have that yet. It’s necessary, so I’ll skip it for now and don’t make a fool of myself, hehe.)

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

查找方法:1、用strpos(),语法“strpos("字符串值","查找子串")+1”;2、用stripos(),语法“strpos("字符串值","查找子串")+1”。因为字符串是从0开始计数的,因此两个函数获取的位置需要进行加1处理。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment