Alamofire.request (. POST, "Http://srxapp.zkkd.com/ios.php/Login/login", headers: ["token": Token]). Responsejson {(data) in
let json = JSON(data: data.data!) print(json)}php端怎么接受 headers 里面的 token值呢
Reply content:
Alamofire.request (. POST, "Http://srxapp.zkkd.com/ios.php/Login/login", headers: ["token": Token]). Responsejson {(data) in
let json = JSON(data: data.data!) print(json)}php端怎么接受 headers 里面的 token值呢
$_server[' Http_token ']
Getallheaders () [' token '];
getallheaders
Is apache_request_headers
the alias, can not be used for the nginx
server, oneself simply write a function
fetch.
function request_header($key = null){ $all_headers = []; foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_') { $all_headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; } } return is_null($key) ? $all_headers : (isset($all_headers[$key]) ? $all_headers[$key] : null);}request_header('token'); // 不传key返回所有heads数组
All request data is placed in $_request.