PHP provides three ways for sesion storage: File/memory/custom storage, using file storage by default. This is not a good way to go on a Web site with a large volume of traffic, because it can result in a lot of redundancy in the input and
Let's take a look at an example: the requirement is to generate 4 digits, insufficient front complement 0
sprintf () function
Does it feel like a C language?
1. Grammar
sprintf (format,arg1,arg2,arg++)Parameter descriptionFormat
The simplest PHP statement imports the database *.sql file into the database
Copy Code code as follows:
$sql =file_get_contents ("Text.sql"); Read the SQL statement as a string into the $sql
$a =explode (";", $sql); Use the explode ()
Yesterday, a colleague encountered a strange problem, that is, the following code, can not pass the JSON checksum, and can not be resolved through the PHP json_decode function.
Copy Code code as follows:
[
{
"title": "",
"Pinyin"
In general, when we use CURL to submit POST data, we are accustomed to writing this:
Copy Code code as follows:
curl_setopt ($ch, Curlopt_postfields, $post _data);
But this kind of writing in some cases will not be very useful, may
In this section, let's look at a less common but powerful PHP feature: FILTERS, which can be used to validate (validation) and error correction (sanitization)When a data source contains unknown or indeterminate data, it becomes useful, at most, for
The basic principle of OB: If the OB cache is turned on, the Echo data is first placed in the OB cache. If header information is placed directly in the program cache. When the page executes to the end, the OB-cached data is put into the program
This article describes how the PHP submission form failed to retain the information to fill out some of the methods summarized, the most common is the use of caching, this method if the slow speed of the network may be a problem, the best way is to
1, the input information to verify the class (mainly used to verify the user name, password, duplicate password, mailbox, can add other functions)
Copy Code code as follows:
/**
* Validator for Register.
*/
Final class
Data structure is very important, algorithm + data structure + document = Program
using PHP to describe the bubble sort algorithm, an object can be an array
Copy Code code as follows:
Bubble sort (Array sort)function Bubble_sort (
Many people appear "Fatal error:cannot use object of type StdClass as array in ..." When PHP outputs a two-dimensional array.The solution analysis is as follows:
Existing such a two-dimensional array:
Copy Code code as follows:
Array (
[0
The Scandir () function returns an array that contains the files and directories in the specified path. As shown below:
Example:
Copy Code code as follows:
Print_r (Scandir (' test_directory '));
?>
Output:
Copy Code
Finding problems is more important than solving problems, using the PHP integrated development Environment Appserv Web pages prompts for a variety of syntax errors, but configuring your development environment without prompting for errors,
The solution is to find the location of the error and then see which variable is not initialized and use it directly, and instantiate the variable first as an empty class. Such as:
Copy Code code as follows:
$CT = new StdClass ();
Modify
Introduction to forged cross-station requests
The forgery of cross station requests is more difficult to guard against, and the harm is great, in this way attackers can play pranks, send spam information, delete data, and so on. Common
BASE62 Type Source code:
Copy Code code as follows:
Class Base62 {
Private $string = "VPH7ZZWA2LYU4BGQ5TCVFIMXJI6XASOK9CNP0OWLJYTHQ8RENMU31BRDGEDKFS";
Public Function Base62_encode ($STR) {
$out = ';
For ($t =floor (log10
Copy Code code as follows:
$file =fopen ("11.txt", "R") or exit ("Unable to open file!"); /fopen Open the file, if it does not exist, the display will not open.
$filesize =filesize ("11.txt");//Calculate File size
Echo fread ($file,
Just contact to the problem, I did not take into account the iterator mode, tried a few general ideas, after the failure .... Directly to look at the source of the implementation of foreach, expect to find a foreach processing object when there is
1. Introduction and creation of interfaceKeywords: interface2. Reference and specification of interfaceKeywords: implementsInterface: A special abstract class in which member attributes are all abstract, the same as canonical function in a program1,
The string compression method provided by PHP has
1.gzcompress-compress a string
This function compress the given string using the ZLIB data format.
2.gzencode-create a gzip compressed string
This function returns a compressed version of the
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