简体   繁体   中英

PHP Debugging, $_SERVER Not all superglobals are shown in debugger

I was using a debugger in VScode: called PHP Debug 1.13.0. And XDebug installed on PC. When I open superglobals I don't see many of them which are actually exists and printable like "$_SERVER['REQUEST_METHOD']". Why are not all of them mentioned in debugger?

在此处输入图像描述

在此处输入图像描述

The best way to debug PHP code (assuming you do not have a configured debugger, or if your debugger is not working properly) is with var_dump(). In your case, something like:

var_dump($_SERVER['method_name']);

Also, you can set up a breakpoint that will terminate program execution with die(), AND give you all the variable info that you need:

die(var_dump($_SERVER['method_name']));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM