서버는 포스트 데이터를 수신 할 수 없습니다 도움이 이유는 무엇입니까?alamofire 게시물의 게시물 데이터를받지 못 했습니까? 나를
public function test(){
sk_base::load_sys_class('logs')->add(date("ymd").'filesDATA',var_export($_REQUEST,true));
echo json_encode(array('data'=>$_REQUEST));
}
// 로 내 코드에 뭔가 문제, 감사
// post data
let parameters : [String: AnyObject] = [
"uuid" : "731DCD02-1E54-4D28-94F3-D47B7A9D62F4",
"sid" : "b172f2697e717d14134d43f477761382",
]
//init request
self.request = Alamofire.request(
"POST",
"http://test.cnjob.com/test/index/test",
parameters: parameters,
encoding:ParameterEncoding.JSON)
//response
self.request?.responseString { (request, response, body, error) in{
println("---\nrequest--------------------------------->" +
"\n\n\(request)\nresponse------------------------->" +
"\n\n\(response)\nbody---------------------------->" +
"\n\n\(body)\nerror------------------------------->" +
"\n\n\(error)")
}
// 서버 코드를했다 결과 : (데이터가 비어 있습니다. 이유는 무엇입니까?)
응답 --------------------------------- ----------------- ->
Optional(<NSHTTPURLResponse: 0x7f845bd63cb0> { URL: http://xxx/test/index/test } { status code: 200, headers {
Connection = "Keep-Alive";
"Content-Length" = 22;
"Content-Type" = "text/html; charset=utf-8";
Date = "Thu, 16 Oct 2014 06:23:23 GMT";
"Keep-Alive" = "timeout=5, max=100";
Server = "Apache/2.4.4 (Win64) PHP/5.4.12";
"X-Powered-By" = "PHP/5.4.12";
} })
본문 ---------------------------------------- ------------->
Optional("{**\"data\":[]**}\r\n")
오류 ----------------------------- -------------------------> nil 서버
'200 상태 코드'는 성공적인 응답을 의미합니다. 이 매개 변수에 사용할 수있는 데이터가 없을 수 있습니다. – Kampai
하지만 서버가 데이터를받지 못했습니다. Alamofire의 코드를 확인하고 매개 변수가 모두 (JSON DATA)입니다. – JNYJ
내 PHP 코드에 문제가 있습니까? – JNYJ