一文讓你學會斷點調試

?

開發過程中難免會有遇到未知的錯誤,指定不能一點點的調試吧!這篇文章帶你使用atom來調試程序。如有任何問題,評論區回復即可。

?

一、在atom安裝php-debug

點擊file->settings一文讓你學會斷點調試然后點擊install,搜索php-debug,這里的搜索如果出不來就需要想辦法了哈!要學會科學上網哈!一文讓你學會斷點調試安裝成功就是這樣的一文讓你學會斷點調試

二、下載Xdebug

下載地址:https://xdebug.org/download,打開地址后可以看到擴展,咔咔這里安裝的是php7.3的一文讓你學會斷點調試但是有倆個php7.3選擇那個呢!打開你的PHP環境可以看到框里的vc15一文讓你學會斷點調試然后把下載的文件放到D:phpstudy_proExtensionsphpphp7.3.4ntsext,這里是咔咔的地址。就是放到你們自己的PHP環境里邊即可。一文讓你學會斷點調試

三、配置

然后找到你的php.ini文件,將下面的配置復制進去。記得需要修改zend_extension的位置。

這個位置跟你的PHP位置有關系。一文讓你學會斷點調試

<span style="display: block; background: url(https://imgkr.cn-bj.ufileos.com/97e4eed2-a992-4976-acf0-ccb6fb34d308.png); height: 30px; width: 100%; background-size: 40px; background-repeat: no-repeat; background-color: #282c34; margin-bottom: -7px; border-radius: 5px; background-position: 10px 10px;"></span>[Xdebug]<br>zend_extension?=?D:phpstudy_proExtensionsphpphp7<span class="hljs-number" style="color: #d19a66; line-height: 26px;">.3</span><span class="hljs-number" style="color: #d19a66; line-height: 26px;">.4</span>ntsextphp_xdebug<span class="hljs-number" style="color: #d19a66; line-height: 26px;">-2.9</span><span class="hljs-number" style="color: #d19a66; line-height: 26px;">.6</span><span class="hljs-number" style="color: #d19a66; line-height: 26px;">-7.3</span>-vc15-nts-x86_64.dll<br>xdebug.remote_enable?=?On<br>xdebug.remote_host?=?localhost<br>xdebug.remote_port?=?<span class="hljs-number" style="color: #d19a66; line-height: 26px;">9000</span><br>xdebug.remote_handler?=?dbgp<br>xdebug.idekey=xdebug-atom<br>

這個位置如何確定呢!如果你使用的是新版的phpstudy,D:phpstudy_proExtensionsphpphp7.3.4ntsext那就是這個位置一文讓你學會斷點調試如果你是舊版本的phpstudy位置在C:phpStudyPHPTutorialphpphp-7.1.13-ntsext一文讓你學會斷點調試

四、測試

以上工作完成之后切記需要重啟一下環境。

這個時候需要做倆件事。

第一打開atom的debug一文讓你學會斷點調試

第二在地址欄輸上地址http://localhost/index.php?XDEBUG_SESSION_START=1這里注意后邊的參數。

此時就會出現一個彈框,地址填寫為你的項目路徑即可一文讓你學會斷點調試這個時候調試面板就出來了,可以看到我們的變量值已經打印出來了。一文讓你學會斷點調試直到這里我們的斷點調試就完成了。

五、總結

配置斷點的重要步驟匯總。

  • atom下載php-debug
  • 下載xdebug并放到對應的PHP擴展里邊
  • 地址欄訪問需要攜帶?XDEBUG_SESSION_START=1
  • atom配置路徑時切忌看好項目路徑的用的是正斜桿
一文讓你學會斷點調試

? 版權聲明
THE END
喜歡就支持一下吧
點贊6 分享