[英]When I debug php with var_dump variable it always outputs file path at the beginning?
我在PHP 7中使用Ubuntu。
PHP 7.0.5-3+donate.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
當我使用var_dump
顯示一些變量來調試PHP腳本時:
<?php
var_dump('tmp string');
var_dump(true);
以下是其輸出:
/var/www/example.com/test.php:3:string 'tmp string' (length=10)
/var/www/example.com/test.php:4:boolean true
為什么總是與以前的文件路徑一起輸出?
我希望它輸出如下:
string 'tmp string' (length=10)
boolean true
我從關於該主題的搜索中獲得了最終結果,但是我繼續尋找其他替代方案,只是想補充一下我為其他人找到的內容。
從Xdebug> = 2.6版本開始,有一些選項可以修改var_dump中顯示的文件名的顯示。
// real output example of the %n specifier
courses_list.php:14:string 'tools' (length=5)
參考: https : //xdebug.org/docs/all_settings#filename_format
xdebug.filename_format = "[Specifier]"
類型:字符串,默認值:...%s%n,在Xdebug> = 2.6中引入
此設置確定Xdebug通過重載的xdebug_var_dump()(默認值:%f)呈現HTML堆棧跟蹤中的文件名的格式(默認值:...%s%n)和位置信息。
說明符:%a
說明符:%f
說明符:%n
說明符:%p
說明符:%s
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.