-1
夥計。我正在建造一個加密硬幣挖掘池,原來的游泳池基於Node.JS.哪個Node.JS沒有達到採礦池的快節奏。所以我建立了一個運行在NGINX和PHP中的池。礦工如何工作,它與Pool API交互。礦工在頭文件中有一些重要的信息,比如礦工類型,版本,容量等等。有沒有辦法用PHP來獲取頭文件,如果不能用JavaScript來完成的話。謝謝。 :)如何使用PHP或JavaScript獲取客戶端響應頭?
使用的是Node.js我所用:req.headers
這是我在PHP中曾嘗試:
$_SERVER["USER"] = www-data
$_SERVER["HOME"] = /var/www
$_SERVER["HTTP_HOST"] = 10.10.31.95
$_SERVER["HTTP_USER_AGENT"] = Jetty/9.4.2.v20170220
$_SERVER["HTTP_ACCEPT_ENCODING"] = gzip
$_SERVER["REDIRECT_STATUS"] = 200
$_SERVER["SERVER_NAME"] = _
$_SERVER["SERVER_PORT"] = 80
$_SERVER["SERVER_ADDR"] = 10.10.31.95
$_SERVER["REMOTE_PORT"] = 57488
$_SERVER["REMOTE_ADDR"] = 10.10.30.0
$_SERVER["SERVER_SOFTWARE"] = nginx/1.10.3
$_SERVER["GATEWAY_INTERFACE"] = CGI/1.1
$_SERVER["REQUEST_SCHEME"] = http
$_SERVER["SERVER_PROTOCOL"] = HTTP/1.1
$_SERVER["DOCUMENT_ROOT"] = /var/www/html
$_SERVER["DOCUMENT_URI"] = /burst.php
$_SERVER["REQUEST_URI"] = /burst?requestType=getMiningInfo
$_SERVER["SCRIPT_NAME"] = /burst.php
$_SERVER["CONTENT_LENGTH"] =
$_SERVER["CONTENT_TYPE"] =
$_SERVER["REQUEST_METHOD"] = GET
$_SERVER["QUERY_STRING"] = requestType=getMiningInfo
$_SERVER["SCRIPT_FILENAME"] = /var/www/html/burst.php
$_SERVER["PATH_INFO"] =
$_SERVER["FCGI_ROLE"] = RESPONDER
$_SERVER["PHP_SELF"] =
$_SERVER["REQUEST_TIME_FLOAT"] = 1507362021.8898
$_SERVER["REQUEST_TIME"] = 1507362021
任何標題,特別是你需要?它應該位於相應的'$ _SERVER [HTTP_HEADER_NAME]'字段中 – apokryfos
您可以在$ _SERVER [「HTTP_HOST」] = 10.10.31.95', '$ _SERVER [「HTTP_USER_AGENT」] = Jetty/9.4.2.v20170220', '$ _SERVER [「HTTP_ACCEPT_ENCODING」] = gzip' –
echo $ _SERVER [「HTTP_HEADER_NAME」];注意:第7行的/var/www/html/index.php中的未定義索引:HTTP_HEADER_NAME –