php
正文web
输出数组
echo
PHP中简单的输出数据调试方法,通常用来输出变量值来肯定的执行到哪个分支。微信
$var = 5;
if($var>0){
echo"1";
}elseif($var>0 && $var<5){
echo"2";
}elseif($var >=5 && $var <10){
echo"3";
}
如上输出为1,执行到if输出。app
注释代码以下
ide
<?php
$var = S;if($var <0){
//do someting
echo "1";
}elseif($var >0 && $var <5){
//do someting
echo"2";} elseif($var >=5 &&$var < 10){
//do someting echo"3";}
?>
输出方式函数
print_r,var_dump,debag_zval_dump
这个主要是输出变量的数据值,特别是数组合对象数据,通常咱们在查看端口的返回值或者不肯定的变量可使用这两个API,debug_zval_dump相似,惟一增长的一个值是refcount,记录一个变量被引用了多少次url
代码spa
<?php
$arr = array(
"key1" => true,
"key2"=> "test",
"key3" => "100",
"key4" => null,);
print_r($arr)
?>
运行后为输出值
.net
var_dump
把输出的变量类型也一并输出出来了
所使用的代码
<?php
$arr = array(
"key1" => true,
"key2"=> "test",
"key3" => "100",
"key4" => null,);
var_dump($arr)
?>
debug_zval_dump
<?php
$arr = array(
"key1" => true,
"key2"=> "test",
"key3" => "100",
"key4" => null,);
debug_zval_dump($arr)
?>
运行后为
对比var_dump来说多出了refcount(2),这个函数,指的是变量被运用了几回
debug_print_backtrace
所使用的的代码
<?php
function a(){
b();
}
function b(){
c();
}
function c(){
debug_print_backtrace();
}
a();
?>
运行后debug_print_backtrace
#0 c() called at [I:\PHPstudy\PHPTutorial\WWW\text.php:6] #1 b() called at [I:\PHPstudy\PHPTutorial\WWW\text.php:3] #2 a() called at [I:\PHPstudy\PHPTutorial\WWW\text.php:11]
debug_print_backtrace能够查看输出的调用栈信息++
exit中止运行
代码以下
<?php
echo"天钧";
echo"渗透云笔记";
exit()
echo"工做室老大是gay";
?>
代码块中出现exit函数就会直接不往下运行,以下
设置debug,以下
先配置一个站点,部署web程序
查看站点
配置debug
PHPini文件配置
[xdebug]
zend_extension=php_xdebug-2.5.4-5.6-vc11-nts.dll
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir ="I:\phpStudy\tmp\xdebug"
xdebug.trace_output_dir ="I:\phpStudy\tmp\xdebug"
xdebug.profiler_output_name = "cache.out.%t-%s"
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "127.0.0.1"
xdebug.remote_port = 9999
xdebug.remote_mode = "req"
xdebug.idekey = PHPSTORM
故障排查
phpini文件配置出错,再次进行配置
排查版本问题
选择对应的版本否则会找不到路径
I:\PHPstudy\PHPTutorial\php\php-5.6.27-nts\ext
排查
Waiting for incoming connection with ide key
由于那你的php.ini配置不当致使,从新配置,核对版本
从新配置
配置成功
视频三分钟,能够略过,由于发了牢骚,我如今挺惧怕医生让我躺着啥也不能干,因此啰嗦了些,布置后事的感受,哈哈哈。交代清楚了,求大佬们打赏哦。
文中使用的靶场源码
后台回复;靶场源码
xdbug下载地址;xdebug.org
顺便,群里的同志,对此我想对大家说
本文分享自微信公众号 - 渗透云笔记(shentouyun)。
若有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一块儿分享。