Describes how to filter strings in PHP. We all know the sample code for PHP to filter strings :? Phpnl2br (); ntobraddslashes (); stripslashes (); when operating on the database, escape the special character chop (); we all know the characters except the string on the right.Sample code for PHP to filter strings:
- <? Php
- Nl2br ();
- // N
- Addslashes (); stripslashes ();
- // Escape special characters for database operations
- Chop ();
- // Remove spaces on the right of the string
- Trim ();
- // Remove all spaces in the string
- Ltrim ();
- // Remove the left space of the string
- Htmlspecialchars ();
- // Convert '$ ','"','<','>'Is the corresponding html object
- Htmlentities ();
- // Convert all html tags to corresponding html entities
- Array explode (string separator, string str );
- // Split the string
- String implode (string separator, array arr );
- // Connection string
- Strtoupper (); strtolower ();
- // Converts uppercase and lowercase letters.
- Ucfirst ();
- // Only converts the first character to uppercase.
- Ucwords ();
- // Convert the first letter of each word to uppercase.
- ?>
We hope that you can gain an in-depth understanding of this knowledge point through the PHP filter string method described in this article.
The following code uses the login PHP code to filter strings :? Php nl2br (); // nto br/addslashes (); stripslashes (); // escape the special character chop () when operating on the database; // remove the character string from the right...