1、使用 phpdbg_break_function()来给这个testFunc() 方法设置一个断点。当代码中调用这个函数的时候,就会进入这个断点中。
prompt> r [Breakpoint #0 in testFunc() at /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php:11, hits: 1] >00011: function testFunc(){ 00012: global $i; 00013: $i += 3; prompt> s [L12 0x109eef620 EXT_STMT /Users/zhangyue/MyDoc/博客文章/dev-blog/php/202006/source/PHPDebug互动扩展.php] >00012: global $i; 00013: $i += 3; 00014: echo "This is 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 "This is testFunc! i:" . $i, PHP_EOL; 00015: }
2、直接进行了两次 s 单步,可以看到 global $i 对应的 opcode 操作是 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 "This is testFunc! i:" . $i, PHP_EOL; 00015: } 00016: prompt> s [L14 0x109eef6c0 CONCAT "This is 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] This is testFunc! i: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();
推荐操作系统:windows7系统、PHP5.6、DELL G3电脑
PHP中如何用session缓存token减少接口请求?
PHP 函数数组操作:掌握高级技巧
Vue history模式下接口重定向到index.html,如何用Apache伪静态配置解决?
框架扩展机制的优点和缺点
在Laravel中使用where查询时,如果你发现小于0.3的记录也会被查出,可能是因为你使用了浮点数比较。浮点数在计算机中存储和比较时可能会出现精度问题,导致一些意外的结果。以下是这个问题的原因和解决方法:原因分析浮点数精度问题:在计算机中,浮点数(如0.3)不能精确表示,可能会存储为类似于0.299999999999999989这样的值。因此,当你使用where('value', '<', 0.3)时,0.299999999999999989可能会被认为小于0.3,从而被查询出来。数据库引擎的处理:不
CentOS7下Zabbix安装界面CSS加载失败如何排查?