PHP Cookie Instance

PHP Cookie InstanceHere is a PHP cookie to set the user login time and expiration time code OH function Logincookie ($uid, $name, $group, $ip, $time){Global $site _domain, $login _key;$domain = (substr ($site _domain,0,4) = = "www.")? substr ($site

PHP analog post and browser request data

]$host = "www.123cha.com";$referer = "http://". $host;$fp = Fsockopen ($host, $errno, $errstr, 30);if (! $fp) {echo "$errstr ($errno) ;n";}else{$request = "get/http/1.1Accept:image/gif, Image/x-xbitmap, Image/jpeg, Image/pjpeg,

PHP Simple database importer [. sql file]

function Insert_file ($file, $replace = ' ") {Global $Charset;$readfiles =read_file ($file);if ($replace) {$readfiles =str_replace (' $timestamp ', ' $timestamp ', $readfiles);}$detail =explode ("n", $readfiles);$count =count ($detail);for ($j =0;

PHP UBB Code conversion function

function Ubb ($string) {$searcharray [' bbcode_regexp '] = Array ("/s*[quote][nr]* (. +?) [Nr]*[/quote]s*/is ","/([Box= (#[0-9a-f]{6}|[ a-z]+)] [nr]* (. +?)] [Nr]* ([/box])/is ","/[url]s*

PHP Programming Normalization

/*y:09.05.05A:jimmyLogin*/ The program starts with instructions. Include ("inc/conn.php");Include ("inc/function.php"); Public files all include in $integrals = get_value (' integrals ', 0); $uid = get_value (' id ', 0); Get the data writing

PHP Ob_start and Ob_end_flush ()

Correlation function DescriptionOb_start ([string output_callback])-Open output bufferAll output information is not sent directly to the browser , but is stored in the output buffer, which is used to process output information.Ob_end_flush-End (send)

Example of php header () function for file download

The code is as follows:Copy code /*** File download ***/Header ("Content-type: text/html; charset = utf-8 ");Download ('web/www.111cn.net. txt ', 'txt file download '); Function download ($ file, $ down_name ){$ Suffix = substr ($ file, strrpos ($

PHP clears all useless tags in the string

Example The code is as follows:Copy code Function Bing_string_cleanr ($ string ){$ String = trim ($ string );$ String = strip_tags ($ string );$ String = htmlspecialchars ($ string, ENT_QUOTES, 'utf-8 ');$ String = str_replace ("n", "", $ string

Php prevents post from submitting duplicate data

The principle is very simple: The session is recorded on the form page, and then submitted to the page for judgment. If it is equal, it is regarded as successful and the session is cleared.Example The code is as follows:Copy code // Enable

Php method for saving session in memcached

1. First install memcached or memcache softwareSee wamp for detailed instructions on installing memcache/memcached.2. Install php_memcache.dll extension3. Set the session to be saved in memcachedMethod 1:Modify the php. Ini file The code is as

Example of PHP + Ajax remote image capture and download

First View ResultsImplementation principleSend request: Send the entered target URL and save path name to image.info asynchronously. php file, which contains an ImageCatch class, Note: Because one is to specify the target image capture, one is to

Php page function setting timeout limit

For functions, we can use the following methods to directly set the timeout time for the function. The code is as follows: Copy code Declare (ticks = 1 );Function (){Sleep (10 );Echo "a

Example of unlimited topic category reading in Php

How to implement the Infinitus topic classification idea: get the auto-increment ID (that is, the parent ID) and then obtain the sub-ID (that is, the uid sub-id) data in the database as follows:Id: 1 uid: 0 I'm column 1Id: 2 uid: 1 I'm column 2Id: 3

Php code for forcibly running advertisements

In this way, after one access, no advertisement will be called. In this way, it's amazing. No advertisement will be skipped. Second, it can increase revenue.The code is as follows:  The code is as follows:Copy code Session_start ();$ LifeTime = 2

Share a PHP remote image collection

The code is as follows:Copy code /* Use PHP to collect remote images. Basic process:1. Obtain the image address of the target website.2. Read the image content.3. Create a path to save the image and name the image.4. Write the image content.5.

Php reads textarea row by row and outputs line breaks to textarea

Let's just move on to the code: The code is as follows:Copy code $ Names = preg_split ('/rn/', $ _ POST ['textarea ']);Foreach ($ names as $ name ){// Todo something eg: echo $ name;} The value is very simple, so the value assignment is not

One-page tool code implemented by PHP

The total number of pages is a piece of wood with a certain length. The ruler slides on the block. On the premise that the two ends of the ruler cannot exceed the block: D. What we need to do is to find the starting point of the ruler on the block,

Php json_encode UTF-8 Chinese problems

The UTF-8 character json_encode is converted into utf16 encoding, that is, the description: The code is as follows:Copy code $./Php/bin/php-r 'echo json_encode ("Chinese ");'"U4e2du6587" Reduced readability, json_encode of the latest php 5.4

Map area data statistics using php-ajax loading data

The effect is shown in the following figure.HTMLLike the previous article on this site that used raphael. js to draw a map of China, first load the raphael. js library file and the chinamapPath. js path file in the head section. The code is as

Php clears html superlinks, JS scripts, and carriage return

A nearly responsible system module is finally coming to an end. The rest of the work is to work with testers to test and modify the module.During this relatively idle time, I secretly wrote several blog posts to record the problems encountered

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