Crawl to the content through the regular expression to do a filter to get the content you want, as to how to use regular expression filter, here is not to do the introduction, interested, the following is a few commonly used PHP crawl Web page
/**********************
A simple directory recursive function
The first way to do this: return objects with Dir
***********************/
function tree ($directory)
{
$mydir =dir ($directory);
echo "\n";
while ($file = $mydir->read ()) {
if ((Is_dir (
/****** Generate session ID ******/basic idea: The current microsecond time to obtain, and then produce a random number, the random number and the current time added after the encryption, and finally intercept the required length/* Function name:
When you see the error prompt
Syntax error, unexpected t_encapsed_and_whitespace, expecting t_string or t_variable or t_num_string
This hint is a question that prompts the variable to use it.
And what I'm showing is that the array was used in the
Copy Code code as follows:
PHP automatically obtains the corresponding constellation function according to the ID number
function Get_xingzuo ($cid) {//automatically returns the corresponding constellation according to the ID number
if
Put it in a common call file (such as a conn database link file), filter a special string for all get or post data to achieve a simple and efficient SQL injection filter
Copy Code code as follows:
Function Inject_check ($sql _str) {
Copy Code code as follows:
@mysql_connect ("localhost", "root", "1981427")//Select database before you need to connect to the database server
Or Die ("Database server Connection Failed");
@mysql_select_db ("test")//Select Database MyDB
Or
Copy Code code as follows:
Insert a new piece of data
number:
Username:
Password:
Copy Code code as follows:
@mysql_connect ("localhost", "root", "1981427")//Select
PHP uses Preg_match to match and determine whether a string contains Chinese or Chinese in the following ways:
$str = ' php learning blog ';
if (Preg_match ('/[\x7f-\xff]/', $str)) {
in the echo ' string there is a Chinese ';
} else{
echo '
Of course, there are other ways to search the Internet can be obtained. I recommend a way to browse both the HTTP page and the WAP page, which is to use the Firefox + wmlbrowser component. Install the Wmlbrowser component Firefox can support the
Copy code code as follows:
function Yzm ($name, $width, $height) {
Header ("Content-type:image/png");
Srand ((double) Microtime () *1000000);//sow a seed that generates random numbers to facilitate the use of the following random
This article describes the simple PDO operation of PHP. Share to everyone for your reference, specific as follows:
There are a lot of information about PDO online. It's not a burden here.
Here I will PDO all operations into a class for ease of
Use PHP to extract birthdays from your identity card, including 15-bit and 18-bit IDs
function Getidcardinfo ($IDCard, $format =1) {$result [' Error ']=0;//0: Unknown error, 1: ID card format error, 2: no error $result [' Flag ']= ';//0 Mark
This example for you to share the two kinds of PHP data Access , we can compare, analyze the similarities and differences between the two ways, and finally provide you with a small exercise, the specific contents are as follows
Way One: obsolete,
Suppose to be called array $my _array;
Copy Code code as follows:
Creates a new, empty array.
$tmp _array = Array ();
$new _array = Array ();
1. Loop out all the rows. ($val is a line)foreach ($my _array as $k => $val) {
$hash = MD5
Today suddenly thought of, wrote a test PHP function code.
Copy Code code as follows:
/**
* Parameter Array $paramlist description
*
* The first-dimensional index of the array is the parameter name of the function that needs to be
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