簡體   English   中英

Netbeans和XDebug用於調試Wordpress

[英]Netbeans and XDebug for debugging Wordpress

我無法正常使用Netbeans和xDebug。 Acutaly debbuging工作正常但只有核心wordpress文件而不是我正在開發的主題文件。 我在網上尋找解決方案並沒有任何效果。

當我開始調試netbeans加載我的主題index.php文件時,不會轉到其他文件,我把它放。

有解決方案嗎

更新:我試過xdebug_break(); 但它現在只有在將它放在header.php文件中才會中斷。 這是Call stack:

file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/header.php.xdebug_break:79 file:/// D:/ Program%20Files / wamp / wamp /www/wordpress/wp-content/themes/whisper/header.php.require_once:79 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/theme.php.load_template: 1114 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/theme.php.locate_template:1090 file:/// D:/ Program%20Files / wamp / wamp / www / wordpress / wp-includes / general-template.php.get_header:34 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-content/themes/whisper/home-template.php.include :10 file:/// D:/Program%20Files/wamp/wamp/www/wordpress/wp-includes/template-loader.php.require_once:43 file:/// D:/ Program%20Files / wamp / wamp /www/wordpress/wp-blog-header.php.require:16 index.php。{main}:17

在我禁用“在第一行停止”選項之前,調試器顯示此行$content = get_the_content(); 並調用堆棧文件正在改變,就像它在那里工作,但不會顯示它。

這似乎與我面臨的問題相同,也沒有找到有效的解決方案。

我設法解決了看xdebug日志的問題。

在一些主題文件(index.php和header.php)中設置一些breakpoits並啟動調試。 有可能看到這樣的事情:

<- breakpoint_set -i 68 -t line -s enabled -f file:///C:/xampp/htdocs/wordpress/index.php -n 40
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="68" state="enabled" id="36480002"></response>
<- breakpoint_set -i 69 -t line -s enabled -f file:///C:/xampp/htdocs/wordpress/index.php -n 58
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="69" state="enabled" id="36480003"></response>
<- breakpoint_set -i 70 -t line -s enabled -f file:///C:/xampp/htdocs/wordpress/header.php -n 20
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="70" state="enabled" id="36480004"></response>

請注意,它識別wordpress根目錄中的斷點而不是/ wp-content / themes /。

所以我試着映射項目的執行。 在“項目屬性”>“運行配置”>“高級...”中,“路徑映射”將“服務器路徑和路徑項目”指向主題目錄。

運行新的調試,breakpoits完美運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM