Three classes summarize PHP's five design patterns

Factory modeSingle-element modeObserver patternCommand chain modePolicy mode class People { Private $name = '; Private $user = null; Private Function __constract ($name) {/* Here Private definition Auxiliary

10 more useful PHP code

http://www.learncomputer.com/10-useful-php-code-snippets/ function getremoteipaddress () { $ip = $_server[' remote_addr '); return $IP; } Copy Code function getrealipaddress () {

Packaged PHP paging class, easy to use

class pagination separate pagination classesCall Mode:$pagenation = new Pagination (4, 10, 200); 4 (first parameter) = CurrentPage, 10 (second parameter) = PageSize, 200 (third parameter) = Total$pagenation->set_link (' http://www.360hqb.com

PHP Infinite Classification Tree data formatting

simplicity is the kingly way .... function Gentree ($items, $id = ' id ', $pid = ' pid ', $son = ' children ') { $tree = Array (); Formatted tree $tmpMap = Array (); Temporary flat data foreach ($items as $item) {

PHP gets the exact code of the client IP address

!--? php /* func:get_client_ip () get client IP address */ function get_client_ip () { $ip =false; if (!empty ($_server["Http_client_ip")) { $ip =

Enables your PHP object to be foreach, with the property being decorated with private

Play a game when you are bored.Traversing an object is simply a matter of iterating through the properties of a particular array type in the object.PHP5 can be directly foreach, but private members of the class cannot access it.The object-oriented

Improved Array_unique ($array) function

After improvement no longer traversed by the length of the array before processing, directly according to the length of the processed array function unique ($ Array) { sort ($array); $arraylength =count ($array);

Brush Baidu drop-down keywords

Brush Baidu drop-down keyword http://www.tongqiong.com/read.php?tid-91-ds-1.html Author: www.tongqiong.com $url 1= "Http://www.baidu.com/s?bs=www.naligouwu.com&f=8&rsv_bp=1&wd=%CD%F8%C9%CF%B9%BA%CE%EF%CD%F8 %d5%be%b4%f3%

Solutions for numbers turning into scientific counting when exporting data to Excel

In the excel.php file $objActSheet = $objPHPExcel->getactivesheet (); Set column name $objActSheet->setcellvalue ("B1", "card number"); Set the width of a column $objActSheet->getcolumndimension (' B ')->setwidth (20);//

PHP class to manipulate MySQL database

PHP class to manipulate MySQL database Database Connection Class//////////////////// Class connect{ private $host;//Host Name private $name;//user name private $pass;//password private $conn;//Connection

Instructions for use-Sina PHP Framework Pure version 1.1 (with beautiful waterfall flow template)

1, this example uses the Xweibo, the framework detailed technical explanation see:Http://x.weibo.com/download.html 2, use this example, only need to do:If no memcache is used, modify the configuration file user_config.php 53 lines Define ('

Php:invalid Command Rewriteengine Solution

An HTTP 500 error occurred while using CodeIgniter, and the view log found the following error: Codeigniter_2.0.2/.htaccess:invalid command ' Rewriteengine ', perhaps Misspelled or defined by a module not included in the server configurationAn HTTP 5

How PHP stores multidimensional arrays with cookies

Deposit $arr = Array (+/-); $arr _str = serialize ($arr); Setcookie ("A", $arr _str); Remove $arr _str = $_cookie[' a ']; $arr = unserialize ($arr _str); Copy CodeMethod Two: Set the multi-key value

Gets the absolute path of the file containing the code for the previous level of the directory

!--? php echo __file__; Get the absolute address of the current file, result: F:\www\test.php echo dirname (__file__);//Get the absolute directory where the current file is located, Result: F:\www\ Echo Dirna

PHP Paging class, first time doing

First time share, let everybody step on @charset "Utf-8"; *{padding:0;margin:0;} . page { font-size:14px; Text-align:center } . Page Ul{list-style-type:none;display:table;margin-left:auto;margin-right:auto}

How to automatically generate static pages on a virtual host

$nowtime =time (); $pastsec = $nowtime –$_get["T"]; if ($pastsec { Exit 1 minutes update, time can adjust itself } Ob_start (); Open buffer Include ("index.php"); $content = Ob_get_contents ();

A comparative analysis of the include () and require () in PHP

PHP's require () and include () are not very different in terms of performance. The only difference is that the file is read and evaluated every time the include () executes, and require () executes the file only once (in fact, the file contents

How PHP gets the date based on the year and week number

!--? php function getweekdate ($year, $weeknum) { $firstdayofyear =mktime (0,0,0,1,1, $year); $firstweekday =date (' N ', $firstdayofyear); $firstweenum =date (' W ', $firstdayofyear); if

Learn about PHP's MVC development with an example

Require ' command/config.php '; Require ' command/app.php '; App::run ($config); ?> Copy CodeLoad the system configuration file and then load the system configuration through the engine.Second, the engine

A small example of PHP using cookies for login verification

copy code 2, Login Detection page checklogin.asp Dim bloginsaved If Request ("Savelog In ") = ' on ' then response.cookies (" Savedlogin ") (" email ") = Request (" email ")

Total Pages: 5208 1 .... 4266 4267 4268 4269 4270 .... 5208 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.