🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# Class **Phalcon\Filter**[](# "永久链接至标题") *implements*[*Phalcon\FilterInterface*](#) The Phalcon\Filter component provides a set of commonly needed data filters. It provides object oriented wrappers to the php filter extension. Also allows the developer to define his/her own filters ~~~ <?php $filter = new \Phalcon\Filter(); $filter->sanitize("some(one)@exa\\mple.com", "email"); // returns "someone@example.com" $filter->sanitize("hello<<", "string"); // returns "hello" $filter->sanitize("!100a019", "int"); // returns "100019" $filter->sanitize("!100a019.01a", "float"); // returns "100019.01" ~~~ ### Constants[](# "永久链接至标题") *string***FILTER_EMAIL** *string***FILTER_ABSINT** *string***FILTER_INT** *string***FILTER_INT_CAST** *string***FILTER_STRING** *string***FILTER_FLOAT** *string***FILTER_FLOAT_CAST** *string***FILTER_ALPHANUM** *string***FILTER_TRIM** *string***FILTER_STRIPTAGS** *string***FILTER_LOWER** *string***FILTER_UPPER** ### Methods[](# "永久链接至标题") public **add** (*unknown* $name, *unknown* $handler) Adds a user-defined filter public **sanitize** (*unknown* $value, *unknown* $filters, [*unknown* $noRecursive]) Sanitizes a value with a specified single or set of filters protected **_sanitize** (*unknown* $value, *unknown* $filter) Internal sanitize wrapper to filter_var public **getFilters** () Return the user-defined filters in the instance | - [索引](# "总目录") - [下一页](# "Class Phalcon\Filter\Exception") | - [上一页](# "Class Phalcon\Exception") | - [API Indice](#) »