XDebug 和 VIM。浏览数组值
有什么办法可以浏览数组内的数据吗?
目前我只能看到 $data[0] = (array)
,无法知道数组里面有什么。
我可以正常变量内的值。
有没有办法看到数组内部?也许是我不知道的命令?
编辑:
我发现我可以使用命令键 ,e
来评估数组或对象。
输入 后,会出现一个 /*{{{1*/ =>; eval:
提示出现,然后我可以输入 /*{{{1*/ =>; eval: $data[0]
查看值。
除非我以以下输出格式得到它:
/*{{{1*/ => eval: $data[0]
$command = 'eval';
EVAL_RESULT = (array) ;
EVAL_RESULT = (string) 'stringfromdata0-1' ;
EVAL_RESULT = (string) 'stringfromdata0-2' ;
EVAL_RESULT = (array) 'stringfromdata0-3' ;
这只做了我想要它做的一半。有没有办法输出数组的键?它只显示值,但键显示为“EVAL_RESULT”,而不是数组的透视键名称。
Is there any way to browse the data inside an array?
Currently I can only see $data[0] = (array)
with no way knowing what's inside the array.
I can the values inside normal variables fine.
Is there a way to see inside the arrays? Maybe a command I'm not aware of?
Edit:
I found out I can use the command keys ,e
to evaluate an array or object.
After I type ,e an /*{{{1*/ => eval:
prompt shows up then I can type /*{{{1*/ => eval: $data[0]
to see the values.
Except I get it in the following output format:
/*{{{1*/ => eval: $data[0]
$command = 'eval';
EVAL_RESULT = (array) ;
EVAL_RESULT = (string) 'stringfromdata0-1' ;
EVAL_RESULT = (string) 'stringfromdata0-2' ;
EVAL_RESULT = (array) 'stringfromdata0-3' ;
This only does half of what I want it to do. Is there any way to output the keys of the array? It only shows me the values, but the keys are shown as "EVAL_RESULT" instead of the their perspective key names of the array.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以在 xdebug 会话中输入 vim 命令
,e
。从那里你可以评估任何你想要的 php 行;例如
,使用 Enter 提交它
注意:这将输出到您的 php-cli 标准输出,或者如果您位于
ob_start
块内,则可能输出到缓冲区;或者如果是从浏览器访问,可能要等整个php请求完成后才会输出。您也许可以将部分输出缓冲区刷新到浏览器,但您必须自己Google一下。我将其发布为答案,尽管它发布在OP的问题中,因为我不阅读OP 的问题,如果我正在寻找答案,并且我想确保人们能够找到它!如果OP把他的答案发布为答案并且ping的是我,我很乐意删除这个。
You can enter the vim command
,e
in a xdebug session.From there you can evaluate any php line you want; for example
and submit it with Enter
Note: This will output to your php-cli stdout, or possibly output buffer if you are inside a
ob_start
block; Or if you are accessing from a browser, it may not output until the entire php request is completed. You may be able to flush a partial output buffer to a browser, but you'll have to Google that one for yourself.I Posted this as an answer even though its posted in the OP's question because I don't read the OP's question if I'm looking for an answer and I want to make sure people can find it! If the OP posts his answer as an answer and ping's me I'd be happy to delete this one.
从来没有按照我想要的方式工作。相反,我发现了更好的东西。
使用 Vundle 我在下面安装了 xdebug 的 VIM 调试器:
https://github.com/joonty/vdebug
只要有机会,我就会发布屏幕截图。
不过,它的作用就像一个魅力。
Never got it the way I wanted it to work. Instead I found something way better.
Using Vundle I installed the VIM debugger for xdebug below:
https://github.com/joonty/vdebug
I'll post a screenshot whenever I get a chance.
Works like a charm though.
编辑 debugger.vim 文件 (~/.vim/plugin/debugger.vim) 并找到类似于将深度变量增加到合理数量的行
(5 应该足够了)
保存并重启vim。
Edit debugger.vim file (~/.vim/plugin/debugger.vim) and find a line similar to
increase the depth varibale to a reasonable amount (5 should be enough)
save and restart vim.
另外,您可以将表达式包装在
var_export(, true)
中,它将显示完整的对象。Also, you can wrap your expression in
var_export(<expr>, true)
, and it will show you the full object.