Verify the validity of the ID card in PHP.
/**
* ID card
*
* @ Param string $ id
* @ Return boolean
*/
Function is_idcard ($ id)
{
$ Id = strtoupper ($ id );
$ Regx = "/(^ \ d {15} $) |
PHP retrieves all links on the specified URl page
// Obtain all links on the specified URL page
Function get_url_href ($ url ){
$ Html = file_get_contents ($ url );
$ Dom = new DOMDocument ();
@ $
PHP lists all databases in MySQL
Define ('nl ', "\ n ");
Define ('TB ','');
// Connecting to MySQL.
$ Conn = @ mysql_connect ('localhost', 'username', 'password ')
Or die (mysql_errno (). ':'.
Convert a pdf file into an image using imagebrick
$ Export _file = './pdf/demoting ';
$ Save_to = './jpg/demo.jpg'; // make sure that apache has permissions to write in this folder! (Common problem)
// Execute
PHP code queried by whois
Use the following function to obtain the complete details of any domain name user.
Function whois_query ($ domain ){
// Fix the domain name:
$ Domain = strtolower (trim ($ domain ));
Search Chinese characters or English letters by the first letter in PHP
/**
*
*/
Function getfirstchar ($ s0 ){
If ($ s0 [0] = 'I' | $ s [0] = 'I '){
Return "I ";
} Elseif ($ s0 [0] = 'U' | $ s [0] =
PHP simple image verification code implementation
// The first code generates a random image ------ code2.php
// Enable session to save the generated content
Session_start ();
$ Table = array (
"Pic0" =>
PHP time processing functions
// Mktime ()
Convert date and time to unix timestamp
// Time ()
Obtains the unix timestamp of the current time.
Echo date ("Y-m-d", mktime ))."";
//
Php generates tag cloud based on word frequency
Given a piece of text, this code analyzes the word frequency distribution of the text and generates a tag cloud
/**
* Tag cloud demo based on word frequency
* @
Definitions of common PHP header
Header ('http/1.1 200 OK '); // OK for normal access
Header ('http/1.1 404 Not Found '); // notifies the browser that the page does Not exist
Header ('http/1.1 301 Moved
PHP file operations
// Filetype ()
Obtain the object type
// Obtain the file type in windows
Echo filetype ("D :\\ lamp \ php5 \ php. ini ")."";
// The output file indicates a normal file.
Php checks whether the browser is a mobile device
This code can be used to check whether users are using mobile devices to browse the web page.
$ Mobile_browser = '0 ';
If (preg_match ('/(up. browser |
Object-oriented mysql database operations php class
Class database {
Var $ host = NULL;
Var $ username = NULL;
Var $ password = NULL;
Var $ databaseName = NULL;
Var $ link = NULL;
Var $
Php numeric to Chinese character amount
/**
* Convert numbers to Chinese
* @ Param string | integer | float $ num target number
* @ Param integer $ mode [true: Amount (default), false: Normal number]
*
Php dynamic processing of images and output display
Php dynamically changes the image size and outputs the image. use the following address when outputting the image:Image_resize.php? Img‑image.jpg & w = 150 & h = 150 & constrain = 1W and h
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