This article briefly introduces the usage of static variables in php functions. For more information, see.
The Code is as follows:
Copy code
Function sendHeader ($ num, $ rtarr = null){Static $ sapi = null;If ($ sapi = null){$
This article introduces php functions ob_start (), ob_end_clean (), and ob_get_contents (). If you need them, refer to them.
Usage of the following three functions
Ob_get_contents ()-return the content of the output buffer
Ob_get_contents
(PHP 4,
For details about the differences between php mysql_escape_string and addslashes, refer to this article.
The mysql_real_escape_string () function escapes special characters in strings used in SQL statements.
The following characters are affected:
To ensure the effectiveness and integrity of the operation, you can use the lock mechanism to convert the concurrent status to the serial status. As one of the lock mechanisms, PHP File locks are also designed to cope with resource competition.
In php, our commonly used operators include Arithmetic Operators, value assignment operators, comparison operators, and logical operators. I will introduce the usage of these operators to you.Arithmetic Operators
The Division operator always returns
We know that the sprintf () function writes formatted strings into a variable, and we often see this type of code. Next I will introduce how to use the sprintf () function, for more information, see.
Usage
Sprintf (format, arg1, arg2, arg
The method for checking the variable type in php is very simple. You can use the gettype () function to return the current variable type. Next I will introduce you to the gettype function to check the variable type in detail, for more information,
In php, there are many functions that can be used to traverse arrays, such as the for statement, list, each, and foreach functions. These are also the main functions used to traverse arrays in php, next I will introduce it to you.
Foreach traversal
Using php to verify the date format, we can use the checkdate () function and regular expression to verify the format. Next I will introduce some of my processes in verifying the date format, finally, the simplest method is obtained.
1. Use regular
This article will summarize some usage of PHP constant types. This is a friend's learning note. I will share it with you.
Once a constant in PHP is defined, it cannot be changed or undefined. constants have predefined constants (internal constants)
Php string is a data type in php, and it plays a very important role in program development. Let me introduce some php string-based knowledge and instructions for use.
Output string
In PHP, there are four methods to output strings. The echo
Next let's take a look at the article about php bcd code compression-compressing decimal numbers into hexadecimal data examples. I hope the article will help you.
For example, compress the php bcd code-compress the decimal number to the hexadecimal
We know that php arrays are divided into multi-dimensional arrays and one-dimensional arrays. Next we will introduce the principles and implementation methods of sorting php multi-dimensional arrays and one-dimensional arrays
The static page looks good. You cannot directly call the PHP file, but you can use js to call the PHP file. Of course, you can also use ajax to call the PHP file. Here I will introduce it to you.
Here is a simple example: For example, you can call
If you want to use php to add a background tile watermark to an image, you must use a php plug-in to add a background tile watermark to the image by using imagick, below we provide an instance code.
If you want to useAdd a background tile watermark
Description: $ maxwidth and $ maxheight can only be passed. If the maximum width is passed, the height is automatically calculated. If the maximum height is passed, the width * is automatically calculated. Return Value: if the file is successfully
This article introduces how to implement the paging function of the database in php and ipve databases. If you need it, let's take a look.
The Code is as follows:
Copy code
Include "/maya/inc/dbconn. php ";$ SQL = "select max
This is a basic thing. We can use constructor to automatically connect to the mysql server when creating classes. We only need to set $ name, $ pass, the value of $ table is enough.
The Code is as follows:
Copy code
Class
The method for generating csv files in php is very simple. Here I will introduce an instance that I used to convert the array directly into a csv file for output. For more information, see.
Example
The Code is as follows:
Copy code
This article describes the usage of php custom functions in detail, including 1. The function name cannot be the same as the existing function name. 2. The function name can only contain letters, numbers, and underscores. 3. The function name cannot
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