php debug phpdbg
簡單記錄一下phpdbg的使用方式。
建立一個簡單sample code
1 | <?php |
先執行phpdbg與想要breakpoint的code
1 | $ phpdbg test.php |

如果有不知道的指令可以使用help
設定斷點在指定的行數
1 | >prompt b 9 # 斷在 $a++; |

列出你要看的function
1 | >prompt l f test # list function test |

列出你設定的breakpoint
1 | >prompt info break |

刪除break point
1 | >prompt break del 1 # 1代表你的第幾的break point |

執行
1 | >prompt run |
觀察變數
1 | >prompt info vars |

執行php
1 | >prompt ev $test = 'ttt' |

單步執行
1 | >prompt s |

結束執行
1 | >prompt finish |

結束phpdbg
1 | >prompt q # quit |