ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Class Phalcon\\Filter # 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 ``` <pre class="calibre14">``` <?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](#) »