In the filter class of zendframework, the system predefines several common filters, which can be used directly, as shown in the following table:
Name |
Filter content |
Name |
Filter content |
Almum |
All content other than letters or numbers |
Int |
Non-positive content |
Alpha |
All non-letter content |
Realpath |
All non-normalized absolute path names |
Basename |
All non-object names in the specified path |
Stringtolower |
Convert all letters to lowercase letters |
Digits |
All non-numeric content |
Stringtoupper |
Convert all letters to uppercase letters |
Dir |
All non-directory parts of the given path |
Stringtrim |
Space at the beginning and end of a string |
Htmlentities |
Replace the HTML tags "<" and ">" |
Striptags |
Remove the HTML content of a string |
Input |
Let's talk about this special story! |
|
|
Among them, the alpha, stringtolower, and stringtolower filters have been mentioned in the first two sections. I will not talk about them here. Let's focus on the rest.
Alnum letter or value filter
The zend_filter_alnum filter can be used to filter non-numbers, non-letters, and content in the given content. For example, a string "'123! $ # ^ & * $ ABC "is" 123abc "after filtering.
This filter is useful when only letters and numbers are required (such as user names.
Htmlentities HTML Filter
The zend_filter_htmlentities filter can filter the HTML code in the given content. This filter encapsulates htmlentities () in the PHP function, so the HTML content through this filter will be filtered out.
For example, if the string content is "
Int integer Filter
The Int filter in the zend_filter filter can perform Integer Conversion on the specified value, that is, filter out the non-integer part. It is very useful for scenarios where the input content is only an integer.
For example, if the content is "23", "5.423", "-4.8", the filtered content is "23", "5", "-4" in turn"
In fact, using intval () in PHP can also achieve this effect.
Striptags HTML character Filter
The zend_filter_striptags filter is used to delete the HTML content in the string. This filter is different from the zend_filter_htmlentities filter. zend_filter_htmlentities converts symbols such as "<" and ">. The zend_filter_striptags filter directly filters out the content contained by the "<", ">" and other symbols!
For example, the string after filtering "" Has nothing to do, because it contains no content except the symbols.
<H1> I love Xiaobai.
You can try it yourself...
Now, let's get here today ~!
A person who has no target will always work for the target person.