After logging on to php, jump back to the page instance to be accessed

The simplest way is to directly use php $ _ SERVER ['http _ referer']If I want to log on to the. php pageNow, go to the B. php page and add the following code in B. php: The code is as follows:Copy code $ Url = $ _ SERVER ['http _

Code of a simple php + Ajax shopping cart program (1/2)

Shopping cart type: shop_cart.phpShopping cart operation: cart_action.phpHome: index.htmlJquery is used for Ajax operations, and a jquery plug-in thickboxLet's not talk about it anymore. You can first look at the effect example.Shop_cart.php is of

Php program for converting Chinese characters to Unicode encoding

Program The code is as follows:Copy code /*** $ Str original string* $ Encoding of the original encoding string. The default value is GBK.* $ Prefix: the prefix after Encoding. The default value is "&#"* $ Postfix: the suffix after Encoding. The

Php random ad display call code

The code is as follows:Copy code ######## Random ad display ##########Function myads (){$ Dir = "ads"; # set the directory for storing records// $ Dir = "ads"; # set the directory for storing records$ Ads = "$ dir/ads.txt"; # set the ad code file$

Php regular expression parses all URL addresses in a string

Share a regular URL expression written by a colleague. Disadvantages: Chinese URLs are not supported: The code is as follows:Copy code (Http [s] {} | ftp): // [a-zA-Z0-9 \. \-] + \. ([a-zA-Z] {2, 4}) (: \ d + )? (/[A-zA-Z0-9 \.\-~! @ # $ % ^ & *

PHP timestamp and date conversion

1. Time conversion function in php The code is as follows:Copy code Strtotime (date ())Date ("Y-m-d H: I", $ unixtime) 2. Obtain the timestamp of today's in php.To obtain the unix timestamp at zero point, you can use $ todaytime = strtotime

Php IP address, email format, telephone number, regular verification

Php verifies the ip format program codeIf the website has a form that requires an IP address, verify that the format is correct.Php verifies whether the ip format is correctly implemented using regular expressions. The core code is as follows: The

Analysis of PHP paging code and paging principle

The so-called paging display means that the result set in the database is manually divided into segments for display. Here two initial parameters are required:How many records per page ($ PageSize )?What is the current page ($ CurrentPageID )?Now,

PHP deletes all file codes in the specified folder

Deletes all objects in a specified folder. The code is as follows:Copy code $ CacheDir = '../cache/runtime ';$ Dh = opendir ($ cacheDir );While ($ file = readdir ($ dh )){If ($ file = '.') | ($ file = '..') {continue ;}If (file_exists ($

Keyword and magic methods in PHP

Common keywords in PHPFinal1. final can only modify classes and methods, but cannot modify member Attributes. Function: a modified class cannot be inherited, and a modified method cannot be overwritten.PHP 5 adds a final keyword. If the method in

Use curl in php to simulate login to discuz and post

The code is as follows:Copy code $ Discuz_url = 'http: // localhost/klive/root/Discuz_X2.5_ SC _GBK/'; // forum address$ Login_url = $ discuz_url. 'Member. php? Mod = logging & action = login '; // logon page address$ Post_fields = array ();//

PHP code generation implementation program

The code is as follows:Copy code    Function UPCAbarcode ($ code){ $ Lw = 2; $ hi = 100;$ Lencode = array ('20140901', '20160901', '20160901', '20160301', '20160301 ','123', '123', '123', '123', '123 ');$ Rencode = array ('20140901', '20160901', '

Trim () and preg_replace () in php clear string spaces and consecutive spaces

The code is as follows:Copy code $ Str = "This line containstliberal rn use of whitespace. nn ";// Remove the start and end spaces.$ Str = trim ($ str );// Remove the blank space crowded with other items$ Str = preg_replace ('/s (? = S)/', '', $

Php saves the database program code to the array

Method 1:Write with serialize, and then output with unserializeSerialize () is to serialize the values of PHP variables such as objects and arrays into strings and store them. serialized strings can be stored elsewhere, such as databases, sessions,

A set of non-repeated number implementation programs are randomly generated in PHP.

The code is as follows:Copy code /*** PHP obtains a set of random numbers without duplicates.*/$ A = microtime ();Function createRandID ($ m ){// Generate an array from 1 to $ m$ Arr = range (1, $ m );// Disrupt the arrayShuffle ($ arr );//

Add a webpage to a desktop shortcut in php

Simple functions and direct code. The code is as follows:Copy code IT development in the fire age Shortcuts. php code The code is as follows:Copy code $ Shortcut ="[InternetShortcut]URL = http://www.111cn.netIDList = IconFile = http://www.

Php class registration and automatic loading _ autoload

Note: __errors in autoload () cannot be caught by try-catch. The code is as follows:Copy code Function _ autoload ($ class_name ){Require_once (PATH. '/calsses/'. $ class_name. '. Php ');}$ Obj1 = new mycalss1 (); Register the _ autoload ()

The PHP regular expression matches the specified tag in the string.

In PHP applications, regular expressions are mainly used:• Regular Expression Matching: matches the corresponding content according to the regular expression.• Regular expression replacement: Match and replace the content according to the regular

Total Pages: 12780 1 .... 6851 6852 6853 6854 6855 .... 12780 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.