Eclipse PDT - 如何调试 $_SESSION、$_GET、$_POST 变量

发布于 2024-09-03 01:46:48 字数 177 浏览 2 评论 0原文

我正在使用 Eclipse PDT 逐步执行代码。当我将鼠标悬停在数组上时,它会显示“$_SESSION = Array [0]”,但不会显示数据。

这对于本地变量来说很好,因为我可以在“变量”窗口中看到它们,但这意味着我看不到 $_GET、$_POST、$_SESSION 的内容。

我该如何解决这个问题?

I'm stepping through code using Eclipse PDT. When I mouseover an array it says e.g. "$_SESSION = Array [0]", but won't show me the data.

This is fine for local varaibles as I can see them in the "Variables" window, but it means that I can't see the contents of $_GET, $_POST, $_SESSION.

How do I fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一世旳自豪 2024-09-10 01:46:48

假设您正在使用 xdebug。

如果您查看“变量”窗口,它还会列出您提到的那些超全局数组(_SESSION、_POST,...)。如果您没有看到它们,请尝试升级 xdebug。我发现对于这个区域(调试期间的变量)来说,它确实有问题。

Assuming you are using xdebug.

If you look in the Variables window, it will have also list those superglobal arrays you mention (_SESSION, _POST, ...). If you don't see them, try upgrading xdebug. I have found it really buggy, for this very area (variables during debug).

如此安好 2024-09-10 01:46:48

在编辑器中,当我在调试会话期间右键单击变量名称时,菜单中会出现“检查”和“监视”选项。

我花了一段时间才发现,要启用这些选择,我必须在右键单击之前在编辑器中选择变量名称。您也可以按 Ctrl+Shift+I 进行“检查”。

“检查”打开一个内容辅助窗口,其中包含可扩展的可变内容。

“Watch”会将变量添加到“Expressions”视图中。

“变量”视图包含调试上下文中的所有变量以及可扩展的内容。

如果数组和对象变量有一个类似 json 的压缩单行显示格式,可以一目了然地看到复杂变量的内容,那就太好了,但我还没有找到一种方法来做到这一点。

我目前使用 Eclipse 3.6 Helios SR1、Xdebug 2.1.0、PHP 5.3.0、Wamp 服务器

In the editor, when I right-click a variable name during a debug session there are choices "Inspect" and "Watch" in the menu.

I took me a while to find out that to enable those choices I had to select the variable name in the editor before right-clicking. You could also press Ctrl+Shift+I for "Inspect".

"Inspect" opens a content assist window with expandable variable content.

"Watch" will add the variable to the "Expressions" view.

"Variables" view contains all variables in the debug context with expandable content.

It would be nice with a condensed json-like one-line display format for arrays and object variables to see the contents of complex variables at a glance, but I have not found a way to do that yet.

I'm currently using Eclipse 3.6 Helios SR1, Xdebug 2.1.0, PHP 5.3.0, Wamp server

本王不退位尔等都是臣 2024-09-10 01:46:48

每个数组的左侧都有一个小箭头。单击此按钮可展开列表以显示值。

There is a little arrow on the left of each array. Click on this expands the list to show the values.

-小熊_ 2024-09-10 01:46:48

这是 XDebug 配置设置问题。

要解决:
转到调试配置 ->选择您的调试配置 ->单击“调试器”选项卡 ->单击服务器调试器的“配置”

在此配置窗口中,有一个“在变量视图中显示超级全局变量”选项。确保启用此配置选项,因为 $_POST 数组是 PHP 固有的超级全局变量之一。

现在,当您运行调试会话时,所有超级全局变量都将在“变量”窗口中可用。这包括 $_POST、$_GET、$_COOKIE 等。

This is an XDebug configuration setting issue.

To solve:
Go to Debug Configurations -> Select your Debug Configuration -> Click on the 'Debugger' tab -> Click 'Configure' for the Server Debugger.

In this configuration window, there is a 'Show super globals in variable view' option. Make sure this configuration option is enabled, as the $_POST array is one of PHP's inherent super global variables.

Now, when you run your debug session, all of the super global variables will be available in the Variables window. This includes $_POST, $_GET, $_COOKIE, et al.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文