我对此How to change an error displayed in codeigniter
有同样的问题我尝试了来自Jordan Arseno的解决方案,因为这是最合乎逻辑的答案,但问题是他建议的类无法加载,因此它坚持使用default error
笨
我想制作一个custom error view
,所以我尝试直接更改文件system/core/URI.php
,但它不能使用重定向功能,因为:
无法在此URI文件中加载
autoload['helper']="url";
。
有谁知道如何解决这个问题?
答案 0 :(得分:0)
更改system / core / Input.php,尝试这个必须工作让我知道如果不起作用,这对我有用
<?php
class MY_Input extends CI_Input {
/**
* Clean Keys
*
* This is a helper function. To prevent malicious users
* from trying to exploit keys we make sure that keys are
* only named with alpha-numeric text and a few other items.
*
* Extended to allow:
* - '.' (dot),
* - '[' (open bracket),
* - ']' (close bracket)
*
* @access private
* @param string
* @return string
*/
function _clean_input_keys($str) {
if (!preg_match("/^[a-z0-9:_\/\.\[\]-]+$/i", $str)) {
/**
* Check for Development enviroment - Non-descriptive
* error so show me the string that caused the problem
*/
if (getenv('ENVIRONMENT') && getenv('ENVIRONMENT') == 'DEVELOPMENT')
var_dump($str);
exit('Disallowed Key Characters.');
}
// Clean UTF-8 if supported
if (UTF8_ENABLED === TRUE) {
$str = $this->uni->clean_string($str);
}
return $str;
}
}
// /?/> /* Should never close php file - if you have a space after can mess your life up */