tutorial on using PHP cookies

function Putcookie ($key, $value, $kptime =0, $pa = "/"){Global $cfg _cookie_encode;Setcookie ($key, $value, Time () + $kptime, $PA);Setcookie ($key. ' __ckmd5 ', substr (MD5 ($cfg _cookie_encode. $value), 0,16), time () + $kptime, $PA);} function

PHP Code Normalization Programming implementation

code example /** @ (#) cngift.php 1.82 03/06/25** Sample documents written by Flowering Stone* will be a simple demonstration of coding specifications**/ Require ("db.php"); /*** Demonstration with Class** @version 1.82 03.06.25* @author

PHP File Upload move_uploaded_file

Tenth chapter (1) file Upload (i)I. Submission of the form:The array that receives common form information is: $_get $_post $_requestThe functions that receive file upload information are: $_filesThe form cannot have the same name when you do

An object-oriented explanation of PHP--construction method and destructor method

The seventh chapter (4) Object-oriented analysis----construction method and deconstruction methodThe use of special reference $thisExample Description:Class Ren{var $xingming;var $nianling;var $xingbie;function Shuohua (){echo "My name is:".

PHP code 301 jump page instance

PHP code-only jump The code is as follows: Copy code Header ("Location: http://www.111cn.net /");?> However, the returned status code is 302.If you want

Using cookies in php to implement shopping cart instances

PHP shopping cart. There are many online stores on the internet. How do they implement shopping cart? Most websites use cookies. I wrote a simple example for your reference.Simple shopping cart with cookiesDatabase: The code is as follows:Copy code

PHP multi-process simple instance program

The code is as follows:Copy code $ Cmds = array (a, B, c, d );Foreach ($ cmds as $ cmd ){$ Pid = pcntl_fork ();If ($ pid =-1 ){Exit ("pid fork error "); }   If ($ pid) {// master process segment to control the number of sub-processesStatic $ max =

Php calls ckeditor? How to call ckeditor

PHP calls FCKeditorPut FCKeditor in the website root directoryThe PHP file contains the/FCKeditor/ckeditor/"target =" _ blank "> fckeditor. Php file.Insert the following code where the editor needs to be placed on the webpage to call it: The code

Four methods to randomly retrieve a piece of data from a php file

The code is as follows:Copy code // Method 1:$ Line = getrandline1('test.txt ');Function getrandline1 ($ filename){$ Linenum = 0;$ Fh = fopen ($ filename, 'r ');While (! Feof ($ fh )) {If ($ rowcontents = fgets ($ fh ))  {$ Linenum ++;$ Contens []

Php retrieves the first image of an article.

First, let's look at a function: The code is as follows:Copy code Function getpic ($ str_img ){Preg_match_all ("//isU", $ str, $ ereg); // the regular expression retrieves the entire image.$ Img = $ ereg [0] [0]; // Picture$ P = "# src = ('|") (.

Php obtains the image address in the CSS file, downloads it, and saves it to a local device.

The code is as follows:Copy code /*** Obtain the image address in CSS and save it to the local device.*/Class getInCssImage    {   /*** Save the image* @ Param $ css url* @ Param $ dir: Directory for saving images* @ Return void*/Static public

Php array_flip () and array_uniqure () delete repeated array elements

The method is as follows: The code is as follows:Copy code $ Arr = array (............) ; // Assume that an array contains 10 thousand elements with repeated elements. $ Arr = array_flip ($ arr); // you can delete duplicate elements.  What is

PHP obtains the location instance of an element in the array.

The syntax of array_keys is as follows:Array_keys (array, value, [strict])When strict is set to true, the strict matching mode of data type verification is triggered. The default value is false. The following code shows a simple application of array_

How php verifies mobile phone numbers

Everyone should have this knowledge. Chinese mobile phone numbers start with numbers "1", and then use "0 ~ 9 "11 digits consisting of 10 digitsNumber combination, then our verification rules must be written according to this idea.Based on the

Php cookies enable second-level domain names to access operational instances

Sometimes two domain names may be on different servers, but we still hope that the second-level domain name can smoothly access the cookie of the primary domain name, and the primary domain name can smoothly access the cookie of the second-level

PHP obtains the real address instance to jump.

Get Response Headers, and then analyze it slowly.Specific Implementation methods are provided: The code is as follows:Copy code $ Header = get_headers ($ url, 1 );If (strpos ($ header [0], '2017 & prime;) | strpos ($ header [0], '2017 & prime ;))

Obtain the memory usage of php code

Memory_get_usage () official syntaxI. Function prototypeInt memory_get_usage ([bool $ real_usage = false])2. Version compatibilityPHP 4> = 4.3.2, PHP 5III. Basic usage and examplesWe can directly use the PHP function memory_get_usage () to check the

Php curl separates header and body Information

In php, you can use curl to simulate http requests and obtain the http response header and body. Of course, you can also set parameters to retrieve only one of them. When both the response header and body are obtained, they are returned as results.

Php injection 1

This article mainly serves the dishes. If you are an old bird, some things may be boring, but as long as you read it carefully, you will find a lot of interesting things.To read this article, you only need to understand the following.1. understand

Implement object-oriented programming in PHP (II)

PolymorphismPolymorphism is defined as the ability of an object to call a method when it is passed as a parameter at runtime. For example, if you use a class to define the method "draw" and inherit the class to redefine the behavior of "draw" to

Total Pages: 12780 1 .... 9415 9416 9417 9418 9419 .... 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.