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

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

Qyouu
TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超11個(gè)贊
要將CodeIgniter與jQuery Ajax一起使用,請(qǐng)使用“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)注
- 965 瀏覽
添加回答
舉報(bào)
0/150
提交
取消