在控制器直接繼承 CI_Controller 的狀況下,打印$this,javascript
[input] => CI_Input Object ( [ip_address:protected] => [_allow_get_array:protected] => 1 [_standardize_newlines:protected] => [_enable_xss:protected] => [_enable_csrf:protected] => [headers:protected] => Array ( ) [_raw_input_stream:protected] => [_input_stream:protected] => [security:protected] => CI_Security Object ( [filename_bad_chars] => Array ( [0] => ../ [1] => [3] => < [4] => > [5] => ' [6] => " [7] => & [8] => $ [9] => # [10] => { [11] => } [12] => [ [13] => ] [14] => = [15] => ; [16] => ? [17] => %20 [18] => %22 [19] => %3c [20] => %253c [21] => %3e [22] => %0e [23] => %28 [24] => %29 [25] => %2528 [26] => %26 [27] => %24 [28] => %3f [29] => %3b [30] => %3d ) [charset] => UTF-8 [_xss_hash:protected] => [_csrf_hash:protected] => [_csrf_expire:protected] => 7200 [_csrf_token_name:protected] => ci_csrf_token [_csrf_cookie_name:protected] => ci_csrf_token [_never_allowed_str:protected] => Array ( [document.cookie] => [removed] [document.write] => [removed] [.parentNode] => [removed] [.innerHTML] => [removed] [-moz-binding] => [removed] [] => --> [ <![CDATA[ [] => <comment> [<%] => <% ) [_never_allowed_regex:protected] => Array ( [0] => javascript\s*: [1] => (document|(document\.)?window)\.(location|on\w*) [2] => expression\s*(\(|&\#40;) [3] => vbscript\s*: [4] => wscript\s*: [5] => jscript\s*: [6] => vbs\s*: [7] => Redirect\s+30\d [8] => (["'])?data\s*:[^\1]*?base64[^\1]*?,[^\1]*?\1? ) ) [uni:protected] => CI_Utf8 Object ( ) )
能夠看到有input的相關信息,只能猜想在Loader.php加載的時候進行的加載php
在Input中會先獲取如下參數,(注:這幾個參數在application\config\config.php 中進行配置)java
allow_get_array ======》 官方說明【Allow $_GET array】 global_xss_filtering ======》 官方說明【Global XSS Filtering】 csrf_protection ======》 官方說明【Cross Site Request Forgery】 standardize_newlines ======》 官方說明【Standardize newlines】
注:這四個參數是有關安全的一些設置,如xss(跨站點攻擊)、csrf(跨站僞造請求)等ajax
而後加載Security類,根據相關參數值相應處理。express
Input類提供瞭如下方法安全
get ====》 獲取get請求的參數值 post ====》 獲取post請求的參數值 post_get ====》 判斷是否爲post請求,若是是以post獲取請求參數值,不然以get獲取 get_post ====》 判斷是否爲get請求,若是是以以get獲取請求參數值,不然以post獲取 cookie ====》 獲取cookie值 server ====》 獲取$_SERVER值,(注:服務端信息) input_stream ====》 獲取 php://input 的參數值 set_cookie ====》 設置cookie值 ip_address ====》 獲取客戶端IP valid_ip ====》 驗證IP是否合法 user_agent ====》 獲取UA request_headers ====》 設置header參數 get_request_header ====》 獲取header參數 is_ajax_request ====》 判斷是否爲ajax請求 is_cli_request ====》 是否爲命令行模式 method ====》 將請求數據轉化爲大寫/小寫