질문에 대한 답변을 얻었지만 CI 코어를 해킹하지 않고 비슷한 방식으로 해냈습니다. 내 application/config/config.php 파일에 다음을 추가했습니다 :
$config['csrf_ignore'] = array('api');
배열에는 원하는 경로가 포함될 수 있습니다. 위의 예는 'api'로 시작하는 경로에 적용됩니다.
그런 다음, 나는 다음과 같은 파일을 추가 : 응용 프로그램/코어/MY_Input.php :
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Input extends CI_Input
{
function _sanitize_globals()
{
$ignore_csrf = config_item('csrf_ignore');
if (is_array($ignore_csrf) && count($ignore_csrf))
{
global $URI;
$haystack = $URI->uri_string();
foreach($ignore_csrf as $needle)
{
if (strlen($haystack) >= strlen($needle) && substr($haystack, 0, strlen($needle)) == $needle)
{
$this->_enable_csrf = FALSE;
break;
}
}
}
parent::_sanitize_globals();
}
}
/* EOF: MY_Input */
두 번째 링크가 고장 –