If the user entered a query that was inserted directly into an SQL statement, the application would be vulnerable to SQL injection, such as the following example:
Copy Code code as follows:
$unsafe _variable = $_post[' user_input '];
Definitions and usageThe Htmlspecialchars () function converts some predefined characters to HTML entities.
The predefined characters are:& (and number) becomes &• "(double quotes) become"• ' (single quotes) become '> (greater than) become
In the beginning, I wanted to directly prohibit the URL of the PHP suffix from being accessed in the rewrite rules. But it turns out that rewrite rules are recursively invoked, and if PHP is banned directly in rewrite rules, then rules that rewrite
This example summarizes the PHP common string comparison functions. Share to everyone for your reference. The specific analysis is as follows:
The substr_compare () function compares two strings from the specified start length , which returns:
In general, the paging file to open gzip compression, the volume can be reduced 60%~90%, for the type of site, you can save a lot of bandwidth and user wait time. However, whether IIS or Apache by default only compressed HTML class static files, for
Here are a few ways to help you solve this problem.
The PHP version converts the in HTML into a line break in a text box:
Copy Code code as follows:
function Br2nl ($text) {
Return Preg_replace ('//i ', ', $text);
}
Copy Code code as follows:
Store your HTML into $html variable.
$html = "
rakesh verma
Example
Google
Yahoo
";
$dom = new DOMDocument ();
$dom->loadhtml ($html);
Evaluate Anchor tag in HTML
$xpath = new Domxpath ($dom);
Today, when I accidentally browsed the web, I found a long microblog, it can convert text into a PNG picture, and then study the PHP text to the way the picture, in fact, only if the use of PHP extension library, GD library to generate pictures, and
1. Calling syntaxUse the function date () implementation to get the current time format, for example:
2. Time format parameter setting"Y-m-d h:i:s" in the above syntax, displayed in the format: year-month-day: minutes: SecondsSo, we can just get
This article illustrates the method of using Func_get_args and Func_num_args functions to implement function overloading in PHP. Share to everyone for your reference. The specific methods are analyzed as follows:
Learning PHP's friends know that
Many times we need to encrypt and decrypt data, such as some data that needs to be stored in cookies, but not easily accessible to users, and then we need to encrypt the data to be stored in a cookie and then decrypt it when we need to use it.
The
The first of these methods
Copy Code code as follows:
$FileID =date ("Ymd-his"). '-' . Rand (100,999);
$FileID a random number such as 20100903-132121-908.
?>
The second method
Copy Code code as follows:
This article summarizes several URL-coded parsing functions in PHP, such as Parse_url, Rawurldecode, Rawurlencode, UrlDecode, and UrlEncode. Share for everyone's reference. The specific usage is as follows:
Here is a look at the introduction and
The examples in this article describe the use of getservbyport and Getservbyname functions in PHP. Share to everyone for your reference. Specifically as follows:
Copy Code code as follows:
String Getservbyport (int $port, string
This article analyzes the usage of filter_input function in PHP. Share to everyone for your reference. The specific analysis is as follows:
In the php5.2, built-in filter module, for the validation and filtering of variables, filter variables and
This article illustrates the function invocation and function definition syntax, and explains the variables in functions and the transfer of numerical methods to functions. Share for everyone's reference. Specifically as follows:
The basis of a
The example of this article describes the PHP MSSQL database connection Class example code, share for everyone to reference.
The specific implementation code is as follows:
Copy Code code as follows:
Class Db_sql {
var $Host = "";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service