以下是laravel给出的回复,我希望从这个得到email
的值。我怎么能这样做..
我刚刚做了
print_r($request);
获取以下数组
Illuminate\Http\Request Object ( [json:protected] => Symfony\Component\HttpFoundation\ParameterBag Object ( [parameters:protected] => Array ( [email] => sa@sysaxiom.com [password] => allau [request] => 1221 ) ) [sessionStore:protected] => [userResolver:protected] => [routeResolver:protected] => [attributes] => Symfony\Component\HttpFoundation\ParameterBag Object ( [parameters:protected] => Array ( ) ) [request] => Symfony\Component\HttpFoundation\ParameterBag Object ( [parameters:protected] => Array ( [email] => sa@sysaxiom.com [password] => allau [request] => 1221 ) ) [query] => Symfony\Component\HttpFoundation\ParameterBag Object ( [parameters:protected] => Array ( ) ) [server] => Symfony\Component\HttpFoundation\ServerBag Object ( [parameters:protected] => Array ( [REDIRECT_MIBDIRS] => C:/xampp/php/extras/mibs [REDIRECT_MYSQL_HOME] => \xampp\mysql\bin [REDIRECT_OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf [REDIRECT_PHP_PEAR_SYSCONF_DIR] => \xampp\php [REDIRECT_PHPRC] => \xampp\php [REDIRECT_TMP] => \xampp\tmp [REDIRECT_STATUS] => 200 [MIBDIRS] => C:/xampp/php/extras/mibs [MYSQL_HOME] => \xampp\mysql\bin [OPENSSL_CONF] => C:/xampp/apache/bin/openssl.cnf [PHP_PEAR_SYSCONF_DIR] => \xampp\php [PHPRC] => \xampp\php [TMP] => \xampp\tmp [HTTP_HOST] => 192.168.1.58 [HTTP_CONNECTION] => keep-alive [CONTENT_LENGTH] => 61 [HTTP_ACCEPT] => application/json, text/plain, */* [HTTP_ORIGIN] => http://192.168.1.58 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36 [CONTENT_TYPE] => application/json;charset=UTF-8 [HTTP_REFERER] => http://192.168.1.58/sa/app/ [HTTP_ACCEPT_ENCODING] => gzip, deflate [HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.8 [PATH] => C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\VisualSVN Server\bin;C:\xampp\htdocs\ibrahim\bootstrap\bootstrap-3.2.0\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4\Doctrine extensions for PHP\;C:\Program Files\TortoiseSVN\bin;D:\Developement\Websites\algrapha;C:\adb;C:\Program Files (x86)\Calibre2\;C:\Program Files\nodejs\;;E:\Sulthan\sw\androidsdk\tools;E:\Sulthan\sw\androidsdk\platform-tools; [SystemRoot] => C:\Windows [COMSPEC] => C:\Windows\system32\cmd.exe [PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY [WINDIR] => C:\Windows [SERVER_SIGNATURE] =>
Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 Server at 192.168.1.58 Port 80
[SERVER_SOFTWARE] => Apache/2.4.9 (Win32) OpenSSL/1.0.1g PHP/5.5.11 [SERVER_NAME] => 192.168.1.58 [SERVER_ADDR] => 192.168.1.58 [SERVER_PORT] => 80 [REMOTE_ADDR] => 192.168.1.58 [DOCUMENT_ROOT] => D:/Development/Websites [REQUEST_SCHEME] => http [CONTEXT_PREFIX] => [CONTEXT_DOCUMENT_ROOT] => D:/Development/Websites [SERVER_ADMIN] => postmaster@localhost [SCRIPT_FILENAME] => D:/Development/Websites/sa/sys/index.php [REMOTE_PORT] => 51808 [REDIRECT_URL] => /sa/sys/appLogin [GATEWAY_INTERFACE] => CGI/1.1 [SERVER_PROTOCOL] => HTTP/1.1 [REQUEST_METHOD] => POST [QUERY_STRING] => [REQUEST_URI] => /sa/sys/appLogin [SCRIPT_NAME] => /sa/sys/index.php [PHP_SELF] => /sa/sys/index.php [REQUEST_TIME_FLOAT] => 1446717323.371 [REQUEST_TIME] => 1446717323 ) ) [files] => Symfony\Component\HttpFoundation\FileBag Object ( [parameters:protected] => Array ( ) ) [cookies] => Symfony\Component\HttpFoundation\ParameterBag Object ( [parameters:protected] => Array ( ) ) [headers] => Symfony\Component\HttpFoundation\HeaderBag Object ( [headers:protected] => Array ( [host] => Array ( [0] => 192.168.1.58 ) [connection] => Array ( [0] => keep-alive ) [content-length] => Array ( [0] => 61 ) [accept] => Array ( [0] => application/json, text/plain, */* ) [origin] => Array ( [0] => http://192.168.1.58 ) [user-agent] => Array ( [0] => Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36 ) [content-type] => Array ( [0] => application/json;charset=UTF-8 ) [referer] => Array ( [0] => http://192.168.1.58/sa/app/ ) [accept-encoding] => Array ( [0] => gzip, deflate ) [accept-language] => Array ( [0] => en-US,en;q=0.8 ) ) [cacheControl:protected] => Array ( ) ) [content:protected] => {"email":"sa@sysaxiom.com","password":"allau","request":1221} [languages:protected] => [charsets:protected] => [encodings:protected] => [acceptableContentTypes:protected] => [pathInfo:protected] => [requestUri:protected] => [baseUrl:protected] => [basePath:protected] => [method:protected] => [format:protected] => [session:protected] => Illuminate\Session\Store Object ( [id:protected] => e49a6db4e413cb6c89c3aa54f6b4bfc8835239b5 [name:protected] => laravel_session [attributes:protected] => Array ( [_token] => vZkuq36fFbiwMTpu3uchkTKiXg1auFdrvTcEK57V ) [bags:protected] => Array ( ) [metaBag:protected] => Symfony\Component\HttpFoundation\Session\Storage\MetadataBag Object ( [name:Symfony\Component\HttpFoundation\Session\Storage\MetadataBag:private] => __metadata [storageKey:Symfony\Component\HttpFoundation\Session\Storage\MetadataBag:private] => _sf2_meta [meta:protected] => Array ( [u] => 1446717323 [c] => 1446717323 [l] => 0 ) [lastUsed:Symfony\Component\HttpFoundation\Session\Storage\MetadataBag:private] => 1446717323 [updateThreshold:Symfony\Component\HttpFoundation\Session\Storage\MetadataBag:private] => 0 ) [bagData:protected] => Array ( [_sf2_meta] => Array ( [u] => 1446717323 [c] => 1446717323 [l] => 0 ) ) [handler:protected] => Illuminate\Session\FileSessionHandler Object ( [files:protected] => Illuminate\Filesystem\Filesystem Object ( ) [path:protected] => D:\Development\Websites\sa\sys\storage/framework/sessions ) [started:protected] => 1 ) [locale:protected] => [defaultLocale:protected] => en )
这是来自档案VerifyCsrfToken.php
public function handle($request, Closure $next)
{
print_r($request);
exit;
return parent::handle($request, $next);
}
我怎样才能得到它?
答案 0 :(得分:1)
试试这个......
public function handle($request, Closure $next)
{
echo $resuest->email;
exit;
return parent::handle($request, $next);
}
参见:http://laravel.com/api/4.2/Illuminate/Http/Request.html http://laravel.com/api/4.2/Illuminate/Http/Request.html