PHP determines whether the string is all Chinese or contains Chinese

$str = "' 324 is"; if (!eregi ("[^\x80-\xff]", "$str")) { echo "All is Chinese"; }else{ echo "not"; } Copy CodeSecond, the judgment contains the Chinese $str = "Chinese"; if

Simple code for PHP to generate short URLs

!--? php /* * php short URL generation * edit:bbs.it-home.org */ CLA SS base62{ private static $base = ' 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ';

A method for filtering PHP string special symbols

How to filter PHP string special symbols: Sometimes we encounter the problem of filtering special characters in strings, this article provides a way to deal with special strings, there may be omissions, if the reader found a message can tell me,

PHP to achieve picture zoom effect

/** * Images class Picture processing class * @author Pan * @package Application.controllers * @since 1.0 */ Class Images { /** * Zoom Picture * @param $source Original picture *

PHP Ini_set and Ini_get function usage

To share the usage of PHP ini_set and Ini_get functions, a friend who learns PHP programming can follow.PHP's Ini_set function is PHP's own function to modify the settings php.ini configuration file, it is convenient to use this function, do not

Modify nginx+php upload File size limit

Introduced under the Nginx and PHP environment to modify the PHP upload file size limit method, to solve the PHP upload file can not be greater than 2M limit, there is a need for friends reference.PHP upload files, first modify the php.ini settings,

PHP simple compression code for English strings

Replacement encryption replacement from the previous version function Compress_func ($match) {return strlen ($match [0]). $match [0]{0};} function Uncompress_func ($match) {return str_repeat ($match [2], $match [1]);} function

Resolve PHP csv file import mysql Chinese garbled

When using PHP to import CSV files to the MySQL database, there is a case of Chinese garbled, here to share the next solution, the need to refer to the friend.Many of the methods are to read and upload the contents of the CSV file into the MySQL

PHP Regular verification of the function of the mailbox

function Isemail ($email) { return strlen ($email) > 8 && preg_match ("/^[-_+.[:alnum:]]+@ (([[: alnum:]]|[ [: Alnum:]] [[: Alnum:]-]*[[:alnum:]]) \.) + ([a-z]{2,4}) | ([0-9][0-9]?| [0-1] [0-9] [0-9]| [2] [0-4] [0-9]| [2] [5] [0-5]) \.) {3} ([0

Php+mysql page shows the recorded code

$pagesize = 10; Set the number of records to display per page $conn =mysql_connect ("localhost", "root", ""); Connecting to a database $rs =mysql_query ("SELECT count (*) from tb_product", $conn); Total Records obtained $RS

PHP Curl forged IP and antecedents

$headers [' client-ip '] = ' 202.103.229.40 '; $headers [' x-forwarded-for '] = ' 202.103.229.40 '; $HEADERARR = Array (); foreach ($headers as $n = = $v) { $HEADERARR [] = $n. ': '. $v; } Ob_

A simple example of PHP Curl spoofing IP

$ch = Curl_init (); curl_setopt ($ch, Curlopt_url, "http://localhost/index.php"); $r = rand (1,255); curl_setopt ($ch, Curlopt_httpheader, Array (' x-forwarded-for:8.8.8. $r, ' client-ip:125.8.8. ' $R)); Constructing IP

A case of PHP access control surface test

Class Foo { Private $name = ' hdj '; Public Function GetName () { return $this->name; } } Class Bar extends Foo { Public $name = ' Deeka '; } $bar = new Bar;

PHP Regular add version information for CSS and JS links (example)

$html = HTML; $ver = ' 1.0.3 '; $p = "/(<> $html = Preg_replace_callback ($p, create_function (' $m ', ' return $m [1]. $m [2]. ( Strpos ($m [2], "?

PHP anti-CC Attack code example

!--? php $P _s_t = $t _array[0] + $t _array[1]; $timestamp = time (); session_start (); $ll _nowtime = $timestamp; if (session_is_registered (' Ll_lasttime ')) { $ll

PHP Preg_match_all matches the picture in the article

$con = file_get_contents ("http://bbs.it-home.org/news/jb-1.html"); $pattern = "//]; Preg_match_all ($pattern, $con, $match); Print_r ($match); ?> Copy CodeOutput: Array ([0] = = Array ([0] = [1] = = [2] = =) [1] = =

PHP image upload and rename six ways to summarize

/* Com_create_guid () is a feature supported by the PHP5 version and can be defined on its own for unsupported versions */ function guid () { if (function_exists (' Com_create_guid ')) { return Com_create_guid ();

PHP get Remote Web page content simple function

$curDomain = $_server[' http_host '); $strHTML = file_get_contents (' http://bbs.it-home.org/DomainParking.asp?gDomName= '. $curDomain); Echo $strHTML ?> Copy CodeFile_get_contents is unstable.Encountered error:

PHP cc Attack defense and anti-quick Refresh code

Proxy IP Direct exit Empty ($_server[' Http_via ')) or exit (' Access Denied '); Prevent Quick refreshes Session_Start (); $seconds = ' 3 '; time period [s] $refresh = ' 5 '; Number of refreshes Setting up

Example of PHP curl_init function usage

Initialize a Curl Object $curl = Curl_init (); Set the URL you need to crawl curl_setopt ($curl, Curlopt_url, ' http://bbs.it-home.org '); Set Header curl_setopt ($curl, Curlopt_header, 1); Sets the curl

Total Pages: 5208 1 .... 3633 3634 3635 3636 3637 .... 5208 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.