PHP by calling Tencent's API interface to return IP all in the city name

  code is as follows copy code /* Call Tencent's API interface return result var ipdata = new Array ("114.238.55.147", "", "Jiangsu province", "Huaian"); 0 for IP address 1 for Null 2 is the province 3 is the city */

Picture address in regular character of PHP regular expression

The code is as follows Copy Code if (Preg_match_all ("/http://[^")]+[.jpg|. Gif|. Jpeg|. Png]+/ui ", Stripcslashes ($content), $aliurl)) {$i = 0; Multiple files + +while (the list ($key, $v) = each ($aliurl [0])) {echo $v. "

PHP City Unlimited Classification

PHP City Unlimited Classification ClassID Classfid className ClassCount1 0 China 02 1 Zhejiang 03 1 Jiangsu 04 2 Hangzhou 05 4 West L. District 0IfFindfather (' 4 ', ' 0 ') shows => HangzhouFindfather (' 4 ', ' 1 ') shows => ZhejiangFindfather (' 4

PHP Bulk save data and batch update data

if ($insert && $insertsql) {PHP Bulk save data and batch update data$keystr = $valstr = $tmp = ';foreach ($insertsql as $key => $val) {if ($val) {$keystr. = $tmp. $key;$valstr. = $tmp. "'". Addslashes ($val). "'";$tmp = ', ';}}if ($keystr && $valstr)

PHP character intercept function

PHP character intercept function function Sub_str ($title, $lengh) {if (strlen ($title) > $lengh){$PP = 2;$len =strlen ($title);if ($len%2<>0){$pp = 1;}$title =substr ($title, 0, $lengh-$pp);$title = $title. ';}return $title;} //------------------

PHP page-Class functions

PHP page-Class functionsfunction Getpagebar ($count = 0){$bad _link_color = "#C0C0C0";$page ["url"] = eregi_replace ("&page=[^&]+", "", BaseName ($_server[script_name)). $_server[query_string]);$page ["result_count"] = (string) $count;$page

PHP Domain name handler function

The following one is to determine whether the domain name entered is legal, and then the http,https,ftp for processing, analysis and send function _scan_url (){$req = $this->_url;$pos = Strpos ($req, '://');$this->_protocol = Strtolower (substr

Summary of Chinese string functions intercepted by PHP

Common php functionsStrstr (string, string) // truncate from the place where a string appears for the first time to the endStrrchr (string, string) // captures a string from its last position to its end.Strpos (string, string [, int]) // position

Example of refreshing data pagination using php + ajax

The index. php file is shown in the following figure. The code is as follows:Copy code Header ("Content-type: text/html; charset = GBK"); // output encoding to avoid Chinese garbled characters?> ajax paging demonstration $ Page = isset ($ _ GET [

Php batch delete specified suffix files in a specified folder

Directly run the code:The following example shows how to delete the html of a specified directory. If you want other files, you only need to change the html to the suffix you want to delete. The code is as follows:Copy code $ Lanmu = array

Php records page code execution time

Core code The code is as follows:Copy code $ T1 = microtime (true );//... Execute the code...$ T2 = microtime (true );Echo 'elapsed Time'. round ($ t2-$ t1, 3). 'Second '; The core code above is described in detail below The code is as follows:

Php regular expression verification email

1. Do not judge the total length. You can add the total length;2. Supports domain name suffixes such as .net.cn and .com.cn;3. The mailbox name must start with a letter or number and can contain "-" and "_" in the middle;4. The domain name must

Several methods for deleting array elements in php

Array_slice () The first parameter is the array to be cut, the second parameter is the starting position, and the third parameter is the length.It is to cut the $ arr array and count it three times from 0th elements. The code is as follows:Copy

Php array sorting methods

Array sorting methodThere are two types:1. Internal (memory) sorting2. External sorting (large data volume, insufficient memory, externalStorage)----------------Sorting is a basic skill for programmers.I. Internal sorting(1) exchange sorting1.

Delete a php program in a non-empty directory

  The code is as follows:Copy code Function removeDir ($ dirName){ If (! Is_dir ($ dirName ))    { Return false;    } $ Handle = @ opendir ($ dirName );While ($ file = @ readdir ($ handle ))! = False)    { If ($ file! = '.' & $ File! = '..')     

A summary of PHP escape characters

I recently encountered code conversion problems in writing bbs. After searching for a long time, we can get a perfect solution to completely restore the author's original article.The following post is for your correction.System: linux php4 oracle8i//

PHP and other languages

1. PHP and ASPASP is actually not a language. It is just the abbreviation of Active Server Pages. The syntax used in ASP is actually a script version of Visual Basic. The biggest drawback is that ASP was born on Microsoft's Internet Information

Batch add data in php

Php form verification code

Function validate ($ value, $ onoff = 0, $ type = 3, $ len = 100, $ msg = 'fill in error '){If (trim ($ value )! = "") {// If there is any contentIf (! Is_int ($ len ))Exit (" ");Preg_match_all ("/[xa0-xff]?. /", $ Value, $ arr); // mix Chinese and

Php Chinese character truncation function

Global $ charset;If (strlen ($ string) Return $ string; }$ String = str_replace (array ('& amp;', '& quot;', '& lt;', '& gt;'), array ('&', '"', ''), $ string );$ Strcut = '';If (strtolower ($ charset) = 'utf-8 '){$ N = $ tn = $ noc = 0;While ($ n $

Total Pages: 12780 1 .... 11735 11736 11737 11738 11739 .... 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.