CI 웹 사이트에 csrf 보호 기능이 있습니다.csrf_protection이 true로 설정된 상태에서 Codeigniter가 오류를 표시합니다.
$config['csrf_protection'] = TRUE;
따라서 새로 고침하여 양식을 다시 제출할 때 다음 오류가 발생합니다.
요청한 동작은 대신이 메시지를 보여주는의
을 허용되지 않습니다, 나는 그것이 마지막 페이지로 돌아가려면.
그래서, 나는 CI_Security 파일을 확장하여 csrf_show_error() 메소드를 오버라이드 (override)하려고합니다.
이
는 응용 프로그램/핵심에있는 내 클래스/My_Security.phpclass MY_Security extends CI_Security {
public function __construct()
{
parent::__construct();
$this->load->library('user_agent');
}
public function csrf_show_error()
{
// show_error('The action you have requested is not allowed.'); // default code
// force page "refresh" - redirect back to itself
// a page refresh restores the CSRF cookie
if ($this->agent->is_referral())
{
redirect(site_url());
} else {
redirect($_SERVER['HTTP_REFERER']);
}
}
}
나는 비에()
전화 멤버 함수 라이브러리에 다음과 같은 오류를 얻고을 객체