欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

phpstormdebug工具yasd怎么用

phpstorm debug工具yasd怎么用,針對(duì)這個(gè)問題,這篇文章詳細(xì)介紹了相對(duì)應(yīng)的分析和解答,希望可以幫助更多想解決這個(gè)問題的小伙伴找到更簡(jiǎn)單易行的方法。

我們提供的服務(wù)有:做網(wǎng)站、成都做網(wǎng)站、微信公眾號(hào)開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、肥鄉(xiāng)ssl等。為超過千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的肥鄉(xiāng)網(wǎng)站制作公司

平常在開發(fā)中,總會(huì)有一些需要 debug 的時(shí)候,手動(dòng)打斷點(diǎn) var_dump、die 等方式總是耗時(shí)耗力還不優(yōu)雅,這時(shí)候可能會(huì)有人選擇安裝 xdebug 擴(kuò)展,在 phpstorm 中配置 xdebug 來調(diào)試。

但當(dāng)你需要用到 swoole 框架時(shí),并需要調(diào)試 swoole 框架中代碼時(shí),xdebug 是不能用在 swoole 上的,是和 swoole 有沖突的。

然后我發(fā)現(xiàn)了一款比較好用的,可以兼容 fpm 框架,和 swoole 框架的 debug 調(diào)試工具,yasd.

安裝

1. Mac 上安裝 boots 庫

brew install boost

2. 從 Github 上下載 yasd 源碼

git clone https://github.com/swoole/yasd.git

3. 編譯安裝 yasd

cd yasd
phpize --clean && \
phpize && \
./configure && \
make clean && \
make && \
make install

4. 修改 php.ini

zend_extension="yasd.so"
;命令行調(diào)試
;yasd.debug_mode=cmd
;遠(yuǎn)程調(diào)試
yasd.debug_mode=remote
;本地開發(fā)地址
yasd.remote_host=127.0.0.1
;本地開發(fā)監(jiān)聽端口
yasd.remote_port=9000

查看擴(kuò)展信息

?  yasd php --ri yasd
yasd
Yasd => enabled
Author => codinghuang <codinghuang@qq.com>
Version => 0.3.9-alpha
Built => Jan 15 2022 14:09:47
Directive => Local Value => Master Value
yasd.breakpoints_file => no value => no value
yasd.debug_mode => remote => remote
yasd.remote_host => 127.0.0.1 => 127.0.0.1
yasd.remote_port => 9000 => 9000
yasd.depth => 1 => 1
yasd.log_level => -1 => -1
yasd.max_executed_opline_num => 0 => 0
yasd.init_file => no value => no value
yasd.open_extended_info => 0 => 0
xdebug.coverage_enable => 1 => 1
xdebug.profiler_enable => 1 => 1
xdebug.remote_autostart => 1 => 1
xdebug.remote_connect_back => 0 => 0
xdebug.remote_mode => req => req
xdebug.idekey => hantaohuang => hantaohuang

5. 調(diào)試腳本

使用 yasd 調(diào)試腳本,必須要添加 -e 的 php 參數(shù),例如這樣

# 調(diào)試普通php腳本
php -e test.php
# 調(diào)試 laravel 的 command
php -e artisan test
# 調(diào)試 hyperf 框架
php -e bin/hyperf start

配置 phpstorm

1. 配置 phpstorm 監(jiān)聽 9000 端口

2. 點(diǎn)擊 phpstorm 右上角的電話圖標(biāo)啟動(dòng)監(jiān)聽

3. 測(cè)試 debug 調(diào)試

在 Laravel 中隨便寫一個(gè) test command

php -e artisan test

到這里就已經(jīng)成功了

調(diào)試 Hyperf 框架

上面說了在 fpm 中調(diào)試,接下來說一下在 Hyperf 框架中如何調(diào)試

需要注意的幾點(diǎn)

1、在 Hyperf 中使用需要將 config.php 中的 scan_cacheable 參數(shù)設(shè)置為 true,該參數(shù)為是否掃描代理類,若設(shè)置為 true,則每次啟動(dòng)都會(huì)直接掃描緩存代理類,而不是重新掃描在生成代理類。

設(shè)置為 true 后需要注意,每次修改代碼需要手動(dòng)生成代理類,composer dump-autoload -o,然后在啟動(dòng)。

或者直接在代理類中修改代碼,當(dāng) debug 結(jié)束后,再將代理類中的代碼復(fù)制到真實(shí)類中。

代理類生成路徑在 runtime/container/proxy

2、在 Hyperf 框架中如果使用到了 Swoole Server,需要將 worker_num 設(shè)置為 1 否則斷點(diǎn)可能不會(huì)生效。該參數(shù)在 server.php 中。

剩下的調(diào)試就和上面講的沒什么區(qū)別了。

關(guān)于phpstorm debug工具yasd怎么用問題的解答就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道了解更多相關(guān)知識(shí)。

名稱欄目:phpstormdebug工具yasd怎么用
分享URL:http://chinadenli.net/article40/ihssho.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、小程序開發(fā)、手機(jī)網(wǎng)站建設(shè)域名注冊(cè)、Google、電子商務(wù)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)