Stateful state mode is one of the GOF23 patterns, and is also a behavioral pattern, as is the case with command mode. The state mode and the command mode are quite similar, and the application of "interface-implementation Class" Is the embodiment of
The code implemented by PHP is first served:
Copy Code code as follows:
function Bubble_sort ($array) {
for ($i = 0; $i for ($j = 0; $j if ($array [$j] > $array [$j + 1]) {//in ascending order
$temp = $array [$j];
$array [$j] =
Prototype mode:
A prototype instance is used to specify the type of object to create, and a new object is created by copying the prototype.Scenario: Classes have a lot of resources, performance and security requirements, and are commonly used in
A very simple example of jQuery mobile + PHP upload via Hyper-global $_files, and then use the Move_uploaded_file () method to move the uploaded image to a folder under the local server,
Here are the HTML and PHP code
Copy Code code as
This article is an example of how PHP saves any network picture to the server. Share to everyone for your reference. The specific analysis is as follows:
Optionally specify a network image address to download to the local server via this function
Page encoding Unification
MySQL database code, HTML page encoding, PHP or HTML file itself to encode all the same.
1, MySQL Database code:the encoding of the database is automatically inherited when the database is created, such as GBK_CHINESE_CI,
First on the source code, you can copy to your computer to run ~
Copy Code code as follows:
multi-File upload
Uploading file information
$img = $_files[' img '];
if ($img)
{
File storage directory, and
Pattern Definition: Appearance mode (façade pattern): External communication with a subsystem must be carried out through a uniform visual object, providing a consistent interface for a set of interfaces in the subsystem, and the appearance pattern
Copy Code code as follows:
/**
* Factory Method mode
*
* Define an interface for creating objects, let subclasses decide which class to instantiate, and delay the instantiation of a class to its subclasses
*/
/*
Class Dbfactory
{
Copy Code code as follows:
/**
* Command mode
*
* Encapsulate a request into an object so that you can parameterize clients with different requests, exclude or log request logs, and support actions that can be canceled
*/
Interface
Copy Code code as follows:
/**
* Combination Mode
*
* Combine objects into a tree structure to represent a "partial-whole" hierarchy that enables customers to have consistent use of individual objects and composite objects
*/
Abstract
1. Preg_replace ()
$msg = Preg_replace ("/ and the middle part
$msg = Preg_replace ("/]+>/", "", $msg); -----is to delete <> and middle content
I (pcre_caseless)
If you set this modifier, the characters in the pattern will match both the
This example describes a method for using base HTTP validation in PHP. Share to everyone for your reference. Specifically as follows:
function Http_auth ($un, $PW, $realm = "Secured area")
{
if (!) ( Isset ($_server[' Php_auth_user ']) &&
This example describes how PHP uses a specified list of characters to generate random strings. Share to everyone for your reference. Specifically as follows:
I hope this article will help you with your PHP program design.
This article describes the PHP implementation of the two array subtraction operation techniques. Share to everyone for your reference. Specifically as follows:
This code passes in two arrays A and B, returning the result of A-b, which is to pick
The example of this article describes the PHP implementation of the conversion of arbitrary number of numbers into 10-binary method. Share to everyone for your reference. Specifically as follows:
PHP converts the number of arbitrary numbers into 10,
Here is a relatively complete code that can be used in practical applications, which is implemented by Ajax combined with PHP code.
The AJAX code is as follows:
Ajax to achieve browsing volume click Add
Current page database number
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