Copy CodeThe code is as follows:
/****** backing up the database structure ******//*Function name: Table2sql ()function function: Convert the structure of a table into SQLFunction parameters: $table: The name of the table to extractReturn value:
Remove empty character elements from an array
Copy the Code code as follows:
$str 1_array=array (' site ', ' ', ' http://www.jb51.net ', ' ', ' 1654 ', ');$str 1_array=array_filter ($str 1_array);Print_r ($str 1_array);?>
Show Results:
Copy
Array_search () Definition and usage
The Array_search () function, like In_array (), looks for a key value in the array. If the value is found, the key name of the matching element is returned. Returns False if it is not found.
Before PHP 4.2.0, the
Today, in doing something about the ping service, because do not want to put the ping service address into the database, so bad, ping service is not an inefficient thing, and then put into the database, not only to reduce the efficiency of the
The following is the code for the basic registry class:
Copy the Code code as follows:
Class Registry {private static $instance;private $request;//The contents class of the RegistryPrivate Function __construct () {}//This class, not
I have written a registry class before, but that one cannot be registered with multiple classes, and the following arrays are used to store the class.
Copy the Code code as follows:
Basic classClass WebSite {//a very simple base classPrivate
PHP Ping Service code actually in the past I have written a class, but, a lot of friends add my friend said, see not quite understand, that is in the form of class, maybe if directly put in the code directly with not very line, today hair can
This time support upload 2 images, upload the original image and poor quality diagram, the original image for the preservation of high-quality pictures, poor quality of the picture for the page display.
PHP Code
Copy the Code code as follows:
I have passed a small test to check which function was faster to create a new file.
File_put_contents vs Touch
Copy the Code code as follows:
for ($i =; $i {File_put_contents (' Dir/file '. $i, ');}?>
Average time:0,1145s
Copy the Code code
Krsort () Definition and usage
The Krsort () function reverses the array by key, preserving the original key for the set value.
The Second optional parameter contains an additional sort flag.
Returns TRUE if successful, otherwise FALSE is
Array_key_exists () Definition and usage
The array_key_exists () function determines whether the specified key exists in an array, returns TRUE if the key exists, or false otherwise.
Grammar
Array_key_exists (Key,array)
Parameter description
Key is
Scheduled Tasks
Copy the Code code as follows:
Ignore_user_abort (); User Close Browser program still executesSet_time_limit (0); No limit on program run time$interval = 3; Program Cycle time interval seconds$link = mysql_connect (' localhost ', '
Let's look at a ternary operation:
Copy the Code code as follows:
$a =1; $b =2; $c =3; $d = 4;echo $a ?>
Generally in other languages (such as C or Java) Rules, the above code of the Operation logic is:
Copy the Code code as follows:
$a
There are times when we are designing a database, such as:
There is a Type field in the article table, he stores the article type, there are 1 headlines, 2 recommended, 3 hot, 4 graphics ..... 11,12,13, wait.
Now there is an article he is a headline,
First of all, my advice is to encounter problems Ferry, PHP manual over 1001 times, the problem solved.
I Baidu a bit, netizens give the answer a variety of.
First correct Baidu to a wrong way:
Copy the Code code as follows:
$sql = "Update Table
I. Numeric data types
Numeric or numeric data is typically two types of double and int in PHP.
PHP is a loosely typed scripting language, paying attention to the way the type is converted.
Copy the Code code as follows:
$a = ' 5 ';A string of
Objective
As the name implies, the file cache to memory cache is the data stored in the file into memory, the implementation of disk operations into memory operations, which can greatly improve the speed of data access, and to achieve distributed
With Phpmail This class, you don't have to worry about it. This is a foreigner wrote a class, we just "take doctrine". Here is a function that is written based on the Send () method inside the class:
Copy the Code code as follows:
function
Copy CodeThe code is as follows:
/*** Get hot words from Baidu* @user Little Jay* @from http://www.isharey.com/?p=354* @return Array returns the hot Word data from Baidu (array return)*/function Getbaiduhotkeyword (){$templateRss =
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