Observer mode
Copy Code code as follows:
Interface Subject
{
Public Function Attach ($Observer); Add Observer
Public Function Detach ($Observer); Kick out The Observer
Public function Notify (); Notify observers when conditions are
Copy Code code as follows:
/*
1 (? s) represents Pattern.dotall, which is the matching line, allowing IMG to appear on multiple lines
2. *? to match any character on behalf of the non greedy until the following condition appears
3.:
First, let's look at a simple example:
Copy Code code as follows:
$a = 2;
($a = = 1)? $test = "Enterprise": $test = "region"; #写法一
Echo $test;
?>
The above example, first determine whether $a is 1 if the "enterprise" is stored in the
PHP more and more applications, but also more and more extensive, in order to increase the richness of the site, resulting in a lot of new technology. Ajax is a modern web site can not be a lack of technology, he can refresh the data asynchronously,
Implementation code, replication is used:Header ("Content-type:text/html;charset=utf-8");function Getrandpass ($length = 6) {$password = ';Add the characters you want to the string below, the default is the number 0-9 and the 26 English
First, the header information is defined to indicate that an Excel is output. Then in the form of a table to the database information loop echo out, just fine.
Copy Code code as follows:
Header ("Content-type:application/vnd.ms-excel")
Friends who do PHP development sometimes want their computer to be able to run a script on a regular basis every day, however, the concept of timed execution of PHP scripts seems to be most often mentioned in Linux, and the following article is
The following is a script to unify the deletion of a table prefixed with "prefix_":
Copy Code code as follows:
Set up database connection information. Database server address, database username, data password
mysql_connect (' Database
Some win host IIS does not support the. htaccess file, I mean here is not local local words with the APMSERV server can use the. htaccess file, the APMSERV server environment configuration pseudo static can see PHP pseudo static (URL rewrite mod_
Each PHP script limits the execution time, so we need to set the execution time of a script to an infinite length by set_time_limit, then use Flush () and Ob_flush () to clear the server buffer and output the script return value at any time.
As
First, the production of ideas
Because the registration code often used to prevent the machine malicious registration, here I published a PNG image validation code of the basic image, simple thinking Analysis:
1, produce a picture of PNG2. Set the
PHP to remove the duplicate value of the two-dimensional array method summary, the specific code is as follows: method One:
Two dimensional arrays Remove duplicate value
function array_unique_fb ($array 2D) {
foreach ($array 2D as $v) {
1, Curl_multi method
When the need for multithreading, you can use Curl_multi one-time request for a number of operations to complete, but curl to go is network communication, efficiency and reliability is relatively poor.
function Main ()
How PHP implements crawling Web images, compared to manual paste copy, the use of small programs to be more convenient and fast, like programming people will always like to make some simple and useful software, recently consulted on the Web a php
The example in this article describes the calendar program that PHP implements. Share to everyone for your reference. as follows:
";
echo "Back";
Exit (); ?> if ($month 12) {$month = 1;
$year +=1; //// echo " year >> "; ?> month >> "
Recently need to detect which pages in the website has not been included in the Baidu search engine to make relevant adjustments. Because the use of site commands To see is really is not to see, think of the use of PHP program to batch processing,
This article introduced a no refreshing news message system, the most concise and understandable an AJAX no refresh message system, the source code omitted the process of accepting data validation, we can expand according to their needs, the
Here we introduce the specific PHP multithreaded implementation code, there is a need to understand the students can refer to.When someone wants to implement concurrency, they usually think of using fork or spawn threads, but when they find out that
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