-
Notifications
You must be signed in to change notification settings - Fork 2
ServerRequest: getServerParams Example
Terry L edited this page Jun 20, 2020
·
3 revisions
Shieldon\Psr7\ServerRequest
Extends Request.
Retrieve server parameters.
-
return
array
Example:
$serverParams = $serverRequests->getServerParams();
print(print_r($serverParams, true));
/* Outputs:
Array
(
[USER] => vagrant
[HOME] => /home/vagrant
[HTTP_COOKIE] => PHPSESSID=pca6qln5ab1k7ihthqvuo7rtietguapm
[HTTP_ACCEPT_LANGUAGE] => en-US,en;q=0.9,zh-TW;q=0.8,zh;q=0.7
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; Win64; x64)
[HTTP_UPGRADE_INSECURE_REQUESTS] => 1
[HTTP_CACHE_CONTROL] => max-age=0
[HTTP_CONNECTION] => keep-alive
[HTTP_HOST] => nantou.welcometw.lo
[CI_ENV] => development
[SCRIPT_FILENAME] => /home/terrylin/public/index.php
[REDIRECT_STATUS] => 200
[SERVER_NAME] => terryl.lo
[SERVER_PORT] => 80
[SERVER_ADDR] => 192.168.33.33
[REMOTE_PORT] => 64557
[REMOTE_ADDR] => 192.168.33.1
[SERVER_SOFTWARE] => nginx/1.14.0
[GATEWAY_INTERFACE] => CGI/1.1
[REQUEST_SCHEME] => http
[SERVER_PROTOCOL] => HTTP/1.1
[DOCUMENT_ROOT] => /home/terrylin/public
[DOCUMENT_URI] => /index.php
[REQUEST_URI] => /
[SCRIPT_NAME] => /index.php
[CONTENT_LENGTH] =>
[CONTENT_TYPE] =>
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[FCGI_ROLE] => RESPONDER
[PHP_SELF] => /index.php
[REQUEST_TIME_FLOAT] => 1591868770.3356
[REQUEST_TIME] => 1591868770
)
*/
composer require shieldon/psr-http
Shieldon PSR HTTP implementation written by Terry L. from Taiwan.