首頁  >  文章  >  開發工具  >  一文讓你學會斷點調試

一文讓你學會斷點調試

咔咔
咔咔原創
2020-07-01 10:20:374207瀏覽

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

#一、在atom安裝php-debug

一文讓你學會斷點調試一文讓你學會斷點調試一文讓你學會斷點調試

#################################################### ######點擊file->settings###然後點擊install,搜尋php-debug,這裡的搜尋如果出不來就需要想辦法了哈!要學會科學上網哈! ###安裝成功就是這樣的######

二、下載Xdebug

#下載網址:https://xdebug.org/download,打開位址後可以看到擴展,咔咔這裡安裝的是php7.3的一文讓你學會斷點調試但有兩個php7.3選擇那個呢!打開你的PHP環境可以看到框裡的vc15一文讓你學會斷點調試然後把下載的文件放到D:\phpstudy_pro\Extensions\php\php7.3.4nts\ext,這裡是咔咔的地址。就是放到你們自己的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><code class="hljs" style="overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; letter-spacing: 0px; padding-top: 15px; background: #282c34; border-radius: 5px;">[Xdebug]<br/>zend_extension = D:\phpstudy_pro\Extensions\php\php7<span class="hljs-number" style="color: #d19a66; line-height: 26px;">.3</span><span class="hljs-number" style="color: #d19a66; line-height: 26px;">.4</span>nts\ext\php_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/></code>

這個位置如何確定呢!如果你使用的是新版本的phpstudyD:\phpstudy_pro\Extensions\php\php7.3.4nts\ext那就是這個位置一文讓你學會斷點調試如果你是舊版的phpstudy位置在C:\phpStudy\PHPTutorial\php\php-7.1.13-nts\ext一文讓你學會斷點調試

4、測試

以上工作完成後切記需要重新啟動環境。

這時候需要做倆件事。

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

第二在網址列輸上位址http://localhost/index.php?XDEBUG_SESSION_START=1這裡注意後邊的參數。

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

五、總結

設定斷點的重要步驟總和。

  • atom下載php-debug
  • #下載xdebug並放到對應的PHP擴充裡邊
  • 網址列存取需要攜帶?XDEBUG_SESSION_START=1
  • #atom配置路徑時切忌看好專案路徑的用的是正斜桿

以上是一文讓你學會斷點調試的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn