2
Slim Framework 및 PUT 요청에 문제가 있습니다. 단추를 클릭하면 만료 시간을 업데이트하는 litte jQuery 스크립트가 있습니다.Slim PUT이 NULL을 반환합니다.
$("#expiry-button").click(function(event) {
event.preventDefault();
$.ajax({
url: 'http://www.domain.com/expiry/38/',
dataType: 'json',
type: 'PUT',
contentType: 'application/json',
data: {aid:'38'},
success: function(){
var text = "Time updated";
$('#expiry').text(text).addClass("ok");
},
error: function(data) {
var text = "Something went wrong!";
$('#expiry').text(text).addClass("error");
}
});
});
항상 "문제가 발생했습니다!" 나는 슬림를 구성한 제의 index.php에서
, 내가 가진이
$app->put('/expiry/:aid/', function($aid) use($app, $adverts) {
$id = $app->request()->put($aid);
$adverts->expand_ad_time($id["aid"]);
});
경우 I var_dump($id)
내가 NULL
응답 헤더 이런 모습 얻을 :
Status Code: 200
Pragma: no-cache
Date: Wed, 08 May 2013 12:04:16 GMT
Content-Encoding: gzip
Server: Apache/2.2.16 (Debian)
X-Powered-By: PHP/5.3.3-7+squeeze15
Vary: Accept-Encoding
Content-Type: text/html; charset=utf-8
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Transfer-Encoding: chunked
Connection: Keep-Alive
Keep-Alive: timeout=15, max=100
Expires: Thu, 19 Nov 1981 08:52:00 GMT
및 요청 기관
Request Url: http://www.domain.com/expiry/38/
Request Method: PUT
Status Code: 200
Params: {
"aid": "38"
}
그래서 의사 소통은 가능하지만 원하는 결과는 아닙니다. 내가 도대체 뭘 잘못하고있는 겁니까? http://jsonlint.com/가 이 함께보십시오 : 유효하지 않기 때문에
고맙습니다! 그것은 완벽하게 작동했습니다! –