안녕하세요, 게시 요청시 세션 설정에 문제가 있습니다. 예를 들어, corectly 작업 요청을 얻을. 게시물 요청 후 리디렉션을 시도했지만이 방법도 효과가 없습니다. 내 코드 섹션이 있습니다.Silex - 게시 요청시 세션을 사용할 수 없습니다.
가 작동하지 :
$app->post(
'/localauth',
'UserController::serviceLoginAuth'
)
->after(
function() {
session_name('auth')
session_start();
}
);
serviceLoginAuth에 재에만없이 사용 :
// redirect to '/authsuccess'
$app->post('/localauth', 'UserController::serviceLoginAuth');
$app->get('/authsuccess', 'UserController::serviceLoginAuthSuccess');
내가 HTTP를 사용 각도 코드를 게시 : 도움을
$http({
url: apiConst.apiurl+'/localauth',
method: "POST",
data: $.param({
login: user.login,
pass:user.pass
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
}).then(function(response){
console.log(response);
$cookies.put('csrftoken',response.data.token);
}).catch(function(){
console.log(err);
});
감사합니다!
어떤 종류의 오류가 발생하고 있습니까? – Andy
이 헤더가 없으면 http 코드 405와 옵션 오류가 발생합니다. 하지만이 헤더는이 오류를 수정하지만 게시 이후에 세션을 보낼 수 없습니다. –