[php] dump
http://symfony.com/doc/current/components/var_dumper.html
The VarDumper Component
The VarDumper component provides mechanisms for extracting the state out of any PHP variables. Built on top, it provides a better
dump()
function that you can use instead of var_dump
.
今天才發現有這個function可以用,debug方便多了~
例如把 $request dump() 出來
Request {#2 ▼ +attributes: ParameterBag {#6 ▼ #parameters: array:3 [▼ "_controller" => "AppBundle\Controller\DefaultController::createActioniAPI" "_route" => "apiAdd" "_route_params" => [] ] } +request: ParameterBag {#4 ▼ #parameters: [] } +query: ParameterBag {#5 ▼ #parameters: [] } +server: ServerBag {#9 ▼ #parameters: array:33 [▼ "USER" => "apache" "HOME" => "/usr/share/httpd" "FCGI_ROLE" => "RESPONDER" "SCRIPT_FILENAME" => "/home/eric_tu/eric_tu/web/app.php" "QUERY_STRING" => "" "REQUEST_METHOD" => "GET" "CONTENT_TYPE" => "" "CONTENT_LENGTH" => "" "SCRIPT_NAME" => "/app.php" "REQUEST_URI" => "/api/add" "DOCUMENT_URI" => "/app.php" "DOCUMENT_ROOT" => "/home/eric_tu/eric_tu/web" "SERVER_PROTOCOL" => "HTTP/1.1" "REQUEST_SCHEME" => "http" "GATEWAY_INTERFACE" => "CGI/1.1" "SERVER_SOFTWARE" => "nginx/1.10.2" "REMOTE_ADDR" => "192.168.109.1" "REMOTE_PORT" => "52221" "SERVER_ADDR" => "192.168.109.128" "SERVER_PORT" => "80" "SERVER_NAME" => "test123" "REDIRECT_STATUS" => "200" "HTTP_HOST" => "test123" "HTTP_CONNECTION" => "keep-alive" "HTTP_UPGRADE_INSECURE_REQUESTS" => "1" "HTTP_USER_AGENT" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36" "HTTP_ACCEPT" => "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8" "HTTP_ACCEPT_ENCODING" => "gzip, deflate, sdch" "HTTP_ACCEPT_LANGUAGE" => "zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4" "HTTP_COOKIE" => "PHPSESSID=ba8at5vmdvcmsdkmbqaj71l1v3" "PHP_SELF" => "/app.php" "REQUEST_TIME_FLOAT" => 1496521759.5115 "REQUEST_TIME" => 1496521759 ] } +files: FileBag {#8 ▼ #parameters: [] } +cookies: ParameterBag {#7 ▼ #parameters: array:1 [▶] } +headers: HeaderBag {#10 ▼ #headers: array:11 [▼ "accept" => array:1 [▶] "accept-encoding" => array:1 [▶] "accept-language" => array:1 [▶] "connection" => array:1 [▶] "content-length" => array:1 [▶] "content-type" => array:1 [▶] "cookie" => array:1 [▶] "host" => array:1 [▶] "upgrade-insecure-requests" => array:1 [▶] "user-agent" => array:1 [▶] "x-php-ob-level" => array:1 [▶] ] #cacheControl: [] } #content: "" #languages: null #charsets: null #encodings: null #acceptableContentTypes: null #pathInfo: "/api/add" #requestUri: "/api/add" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Session {#64 ▶} #locale: null #defaultLocale: "en" -isForwardedValid: true }
留言
張貼留言