Profile
Create patternGuarantees that a class has only one instance and provides a global access point to access it
Characteristics
1, a class has only one instance2. It must create this instance on its own3. This example must be provided to the
The ternary operator's functionality is consistent with the "if....else" process statement, which is written in a single line, with a streamlined code and high execution efficiency. Using the ternary operator appropriately in a PHP program can make
Question mark comma operator syntax
The code is as follows
Copy Code
$a = 1;$b = $a ==1? ' A ': ' B ';echo $a;Result outputA
Parse the above statement into if else
The code is as follows
Copy
Here are a few ways to jump:
One of the most common methods on the Web:
The code is as follows
Copy Code
$url = $_get[' url '];Header ("Location: $url");?>
Put this code in a folder, named for example go.php
PHP error hint "Undefined variable": variable undefined, if you block the notice level in php.ini settings then he will not show any prompts, but for the sake of the rigor of the program, we try to avoid any warning, Errors, and other obvious
Share a method to meet these two conditions at the same time, not only to facilitate the Web site program error debugging, but also does not affect the normal operation of the site debugging methods. Copy the following PHP statement to the top of
After successfully compiling the installation Nginx 1.4, PHP 5.4 on centos6.4 x86_64, after successfully starting Nginx and PHP-FPM, access the PHP prompt error and see in the error log:
Primary Script Unknown ...
Where the Nginx configuration
PHP Tutorial Design mode builder mode and adapter (adapter mode)
Adapter mode** Convert the interface of a class to another interface that the customer expects, and those classes that are not compatible to work together can work together
Builder
Bitwise operators
Bitwise operators allow placement of the bits specified in the integer number. If both the left and right arguments are strings, the bitwise operator will manipulate the ASCII value of the character.
Do not move more than 32 bits
There was a particularly strange problem today when doing a function of API increments. When I used curl to try Tomcat post data, Tomcat actually made an error, and the data I post
Not correct or to get. However, I use Curl post
The generation of automatic miniature graphsBecause of the large amount of data in the picture, the transfer process is relatively long, so when users browse the picture, often want to firstDisplays a thumbnail of a picture.Although you can scale
How to generate static Web pages in PHPSee a lot of friends in various places post asked PHP to generate static article system method, previously had done such a system, and then talk about some views, for you to reference. Well, let's look at some
BreakThe break ends the execution of the current for,foreach,while,do-while or switch structure.
Continue
Ends the current loop and jumps to the next example:
while (1) {
if ($mrs [' lm_name ']== ' home ' | | $mrs [' lm_name ']== ' forum ')
Definition and usageThe explode () function separates strings into arrays.SyntaxExplode (separator, string, limit)ExampleIn this example, we split the string into an array: The code is as follows:Copy code $ Str = "Hello world. It's a beautiful
Php Tutorial functions-use of system function recursive functions to reuse function constructors/** 1. Internal function: PHP can declare the function inside the function.* The purpose is to call the function internally.* Used to help external
The ftp_connect () function creates a new ftp connection.If the connection succeeds, a connection id is returned. Otherwise, false is returned.SyntaxFtp_connect (host, port, timeout)*/$ File = 'public _ html/index. php tutorial '; // define a file$
The code is as follows:Copy code If (preg_match ("/d {4}-d {2}-d {2}/", "start to be large. Lhasa, everyone leaves the room at 12:12:12 on ")){Echo 'Ye ';} Else {Echo 'no ';}?>
Function descriptionString file_get_contents (string $ filename [, bool $ use_include_path [, resource $ context [, int $ offset [, int $ maxlen])Like file (), only file_get_contents () can read the file into a string. The content with the length of
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