CodeIgniter不允许使用关键字符CodeIgniter给了我一个Disallowed Key Characters错误。我已经将它缩小到表单字段的name属性:name='prod[50-4121.5]'但我不知道该怎么做。
3 回答
慕容3067478
TA贡献1773条经验 获得超3个赞
打开libraries/Input.php(system/core/Input.php在CI版本2.0+中)并找到function _clean_input_keys($str){,整个块应如下所示:
function _clean_input_keys($str){
if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str))
{
exit('Disallowed Key Characters.');
}
return $str;}修改允许新字符的PCRE sot。
请注意,缺少的字符是.(点),你应该总是.在正则表达式中转义(点),否则它们将允许任何单个字符。
/^[a-z0-9:_\/-\.]+$/i
Qyouu
TA贡献1786条经验 获得超11个赞
要将CodeIgniter与jQuery Ajax一起使用,请使用“Object”作为数据而不是Query字符串,如下所示:
$.ajax({
url: site_url + "ajax/signup",
data: ({'email': email, 'password': password}), //<--- Use Object
type: "post",
success: function(response, textStatus, jqXHR){
$('#sign-up').html(response);
},
error: function(jqXHR, textStatus, errorThrown){
console.log("The following error occured: "+
textStatus, errorThrown);
}});- 3 回答
- 0 关注
- 989 浏览
添加回答
举报
0/150
提交
取消
