本文介紹了為什么使用 filter_input() 更好?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時(shí)送ChatGPT賬號(hào)..
這應(yīng)該是一個(gè)基本問題,但為什么使用這樣的東西更好:
This should be a elementary question but why is better to use something like this:
$pwd = filter_input(INPUT_POST, 'pwd');
而不僅僅是:
$pwd = $_POST['pwd'];
PS:我知道過濾器擴(kuò)展可以與更多參數(shù)一起使用,以提供額外的清理級(jí)別.
PS: I understand that the filter extension can be used with more arguments to provide an additional level of sanitization.
推薦答案
不是.$_GET
、$_POST
、$_COOKIE
和 $_REQUEST
是 使用默認(rèn)過濾器過濾.filter_input(INPUT_POST, 'pwd')
沒有附加參數(shù)也使用默認(rèn)過濾器.所以完全沒有區(qū)別.
It's not. $_GET
, $_POST
, $_COOKIE
and $_REQUEST
are filtered with default filter. filter_input(INPUT_POST, 'pwd')
without additional parameters also uses the default filter. So there is no difference at all.
這篇關(guān)于為什么使用 filter_input() 更好?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!