CI 版本:2.2.0
我在 /CI220/application/libraries/MY_Security.php 创建一个文件 我设置的配置文件
$config['subclass_prefix'] = 'MY_';
我发现它没有加载 MY_Security,我的 MY_Controller 正在加载,但不是这个库。以下是我的调用堆栈日志:
Call Stack
# Time Memory Function Location
1 0.0004 242064 {main}( ) ../index.php:0
2 0.0009 244352 require_once( '/Users/User/Sites/CI220/system/core/CodeIgniter.php' ) ../index.php:202
3 0.0091 478200 load_class( ) ../CodeIgniter.php:213
4 0.0096 489872 CI_Input->__construct( ) ../Common.php:174
5 0.0097 491432 CI_Input->_sanitize_globals( ) ../Input.php:103
6 0.0232 499224 CI_Security->csrf_verify( ) ../Input.php:647
7 0.0233 499432 CI_Security->csrf_show_error( ) ../Security.php:149
我没有从 Security 加载我的扩展库。我想覆盖csrf_show_error函数
public function csrf_show_error()
{
show_error('The action you have requested is not allowed.!!!');
}
最佳答案
Security 类位于 system/core/Security.php
Email 类位于 system/libraries/Email.php
核心类可以引用这个链接: http://www.codeigniter.com/user_guide/general/core_classes.html
核心类总是自动加载的,所以你不需要也包含在自动加载中。
关于php - codeigniter 安全扩展不起作用,覆盖 csrf_show_error 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27914189/