Eclipse debugger (PHP) - how to see super globals and class properties?
Is it possible to see PHP sup开发者_如何学Cer globals like $_SESSION and $_POST in the debugger variables perspective?
Also, in the following example...
class myclass {
public myvar = 'value';
...
}
... if I'm debugging the class I'd like to be able to see $this->myvar in the debugger
It appears as though the availability of superglobals changed significantly in ZS8. From this post in Zend Forums:
During development of Zend Studio 7 the decision was made to restrict the variables list displayed in the Variables view to the current scope (e.g. current function scope). We are convinced that this approach provides better usability and performance of debugging. BTW, this is a standard approach for many IDE products.
I can't say this makes much sense to me (actually it's a pain in the neck) and if it is indeed becoming standard in many IDEs that seems less like justification for the ZS8 change and more like a widespread bad idea. But I'll quit griping.
The post seems to insinuate that you can view the superglobals by switching the stack you are viewing in the debugger (and they gave this rather unhelpful link). I have not had success with this.
For the time being, the only apparent way to view superglobals is by opening the expressions view (Window > Show View > Expressions) and typing in the variable you wish to see.
You can add a watch expression for that variable in the Expression View. If you don't already have the Expression View in your perspective you can do so from the top menu
Window -> Show View -> Expressions
then click the + (plus sign) and enter $_POST. It can be any expression that would evaluate in the scope you're in. So, $this->myvar would work.
You can do it in Zend Studio (which is based on eclipse) and in PDT (another version for php that is based on eclipse). I would try Netbean because it got a great editor/debugger and as bonus you get a very powerful editor for JS, Css and HTML. In all of these IDEs you can browse to the variable tab (in eclipse it will be under the debug perspective) and there you can see 'this', Super Globals etc'.
精彩评论