1. Use phpdbg_break_function() para testarFunc().点中。
prompt> r [Ponto de interrupção # 0 em testFunc() em /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php:11, hits: 1] >00011: função testFunc(){ 00012: global$i; 00013: $i += 3; prompt> s [L12 0x109eef620 EXT_STMT /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] >00012: $i global; 00013: $i += 3; 00014: echo "Este é testFunc! i:" . $i, PHP_EOL; prompt> s [L12 0x109eef640 BIND_GLOBAL $i "i" /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] [L13 0x109eef660 EXT_STMT /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] >00013: $i += 3; 00014: echo "Este é testFunc! i:" . $i, PHP_EOL; 00015: }
2. O valor global de $i e opcode são BIND_GLOBAL.
prompt> s [L13 0x109eef680 ASSIGN_ADD $i 3 /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] [L14 0x109eef6a0 EXT_STMT /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] >00014: echo "Este é testFunc! i:" . $i, PHP_EOL; 00015: } 00016: prompt> s [L14 0x109eef6c0 CONCAT "Este é testFunc!"+ $i ~1 /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] [L14 0x109eef6e0 ECHO ~1 /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] Este é o testeFunc! eu:4 [L14 0x109eef700 EXT_STMT /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] [L14 0x109eef720 ECHO "n" /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] [L15 0x109eef740 EXT_STMT /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] >00015: } 00016: 00017: testFunc();
以上就是php方法断点的实现,大家学会后也赶快尝试下实例操作吧。