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 Simple File Download filter judgment function

if (Strpos ($fileurl, ':/'))//remote file{Header ("Location: $fileurl");}else//Local Files{if ($d = = 0){Header ("Location:"). Site_url. $fileurl);}Else{$fileurl = file_exists ($fileurl)? Stripslashes ($fileurl): Phpcms_root. $fileurl//This may be a

PHP imagecreate Picture Generation Code

if (Isset ($GD) && $gd ==1 && $txt){Header ("Content-type:image/png");$txt = UrlDecode (Phpcms_auth ($txt, ' DECODE ', Auth_key));$imageX = strlen ($txt) *9;$im = @imagecreate ($imageX,) or Die ("Cannot Initialize new GD image Stream");$bgColor =

PHP imitates spiders to crawl content and analyze

Header ("CONTENT-TYPE:TEXT/HTML;CHARSET=GBK");$message =$_post[' message '];$contents = @file_get_contents ("$message");if ($contents = = "Forbidden") {$ch = Curl_init ();$timeout = 5;curl_setopt ($ch, Curlopt_url, "$message");curl_setopt ($ch,

Introduction to the PHP file on the Portal tutorial

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 multiple forms of uploading files at

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.

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,

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 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 saves array variables to files

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 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 ;))

Use. htaccess to remove index. php of codeigiter

The personal method is not bad: The code is as follows:Copy code Options + FollowSymLinksRewriteEngine onRewriteBase/posterRewriteCond $1! ^ (Index. php | images | robots.txt)RewriteCond % {REQUEST_FILENAME }! -FRewriteCond % {REQUEST_FILENAME }!

PHP variable usage in php learning Notes

If you define variables and constants, how many aspects will you pay attention? You may think:• How to Define variables? What is the difference between variables and C?• Are variables case sensitive?• Are there other important PHP variables?• Are

Session in php to save user login information

Simple session creation The code is as follows:Copy code Session_start ();$ Username = "nostop ";Session_register ("username ");?> In this example, we registered a variable named username with the value of nostop to the session.Read

Php character comparison strcmp () function usage

Return value after ComparisonIf str1 and str2 are equal, 0 is returned.If str1 is smaller than str2, return If str1 is greater than str2, return> 0 (but different timing 1, the specific value size depends on the actual situation ).Example The code

Example of Chinese and English string length truncation in php

Before using this method, enable the php_mbstring.dll extension in php. ini and remove the semicolon before extension.Many methods to intercept Chinese strings do not support the number of Chinese characters,The following code can be implemented:

Php recursive method to implement unlimited classification instances

Array: The code is as follows:Copy code $ Items = array (Array ('id' => 1, 'pid '=> 0, 'name' => 'Level 1 11 '),Array ('id' => 11, 'pid '=> 0, 'name' => 'Level 1 12 '),Array ('id' => 2, 'pid '=> 1, 'name' => 'Level 2 21 '),Array ('id' => 10,

PHP two-dimensional array deduplication custom function

Example 1 The code is as follows:Copy code Function unique_array_2d ($ array2D, $ stkeep = false, $ ndformat = true){// Determine whether the primary array key is retained (the primary array key can be non-numeric)If ($ stkeep) $ stArr =

Total Pages: 12780 1 .... 11741 11742 11743 11744 11745 .... 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.