CodeIgniter不允許使用關(guān)鍵字符CodeIgniter給了我一個Disallowed Key Characters錯誤。我已經(jīng)將它縮小到表單字段的name屬性:name='prod[50-4121.5]'但我不知道該怎么做。
3 回答

慕容3067478
TA貢獻1773條經(jīng)驗 獲得超3個贊
打開libraries/Input.php
(system/core/Input.php
在CI版本2.0+中)并找到function _clean_input_keys($str){
,整個塊應(yīng)如下所示:
function _clean_input_keys($str){ if ( ! preg_match("/^[a-z0-9:_\/-]+$/i", $str)) { exit('Disallowed Key Characters.'); } return $str;}
修改允許新字符的PCRE sot。
請注意,缺少的字符是.
(點),你應(yīng)該總是.
在正則表達式中轉(zhuǎn)義(點),否則它們將允許任何單個字符。
/^[a-z0-9:_\/-\.]+$/i

Qyouu
TA貢獻1786條經(jīng)驗 獲得超11個贊
要將CodeIgniter與jQuery Ajax一起使用,請使用“Object”作為數(shù)據(jù)而不是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 關(guān)注
- 948 瀏覽
添加回答
舉報
0/150
提交
取消