<http://php.net/filter_has_var” rel=“noreferer”>filter_has_var(
如果出于某种原因对超级全球化进行净化,则可能有用,因为超级全球对原始投入数据进行核对,而不是从_GET、_POST、_ETC美元购买。
例如:
$_GET["injected"] = 123;
var_dump( filter_has_var(INPUT_GET, "injected") ); // false
// or the other way round
While you can overwrite the variable, the filter
extension accesses a separate copy. And INPUT_GET
will not alias to the $_GET
superglobal.
Apart from that another reason is to use it for unification. If you use filter_var extensively, than a ruleset would be more fond of using filter_has_var() over isset().
但是,由于任何令人难以置信的业绩原因,不能使用一种或另一种。