Previously, the R & D channel published "use directly, 10 PHP code snippets", which was well received by netizens. In this article, I will continue to share nine extremely useful PHP code snippets. When developing websites, applications, or blogs,
Today we will introduce you to the specific methods for PHP to obtain the function of the current url. Through understanding this function method, we will further deepen our understanding of the PHP language, improve Our learning level.
The PHP 5.0
After two days of Regular Expression learning and studying wordpress routing functions, the custom wordpress routing function is successfully implemented. The following describes the implementation of routing rules.If you want to pass custom url
Example 1
Copy codeThe Code is as follows: php function specifies the default value -www.jbxue.com Function printMe ($ param = NULL){Print $ param;}PrintMe ("This is test ");PrintMe ();?>
Output result:This is test
Example 2 use the default values
Definition and usageThe PHP function microtime () returns the current Unix Timestamp and the number of microseconds.PHP function microtime () syntaxMicrotime (get_as_float)PHP function microtime () parameter and descriptionIf the get_as_float
Put it in a public call file (such as a conn database link file) to filter all GET or POST data with special strings for simple and effective SQL Injection filtering.
Copy codeThe Code is as follows:Function inject_check ($ SQL _str ){Return eregi (
Copy codeThe Code is as follows:// Open discuz/api/uc. php// Locate the synlogin method (Row 1) and locate it.If ($ member = getuserbyuid ($ uid, 1 ))){Dsetcookie ('auth', authcode ("$ member [password] \ t $ member [uid]", 'encoding'), $ cookietime
Copy codeThe Code is as follows:Function unicode_encode ($ name){$ Name = iconv ('utf-8', 'ucs-2', $ name );$ Len = strlen ($ name );$ Str = '';For ($ I = 0; $ I {$ C = $ name [$ I];$ C2 = $ name [$ I + 1];If (ord ($ c)> 0){// Two-byte text$ Str. = '
Have you ever been or are you worried about how to modify a website containing thousands of pages in the shortest time? So you can take a look at the introduction of this article, which may be helpful to you.
What isSSI?
SSI is the abbreviation of
Php exec in linux, the return value cannot be a negative number. For more information, see.
Let's take a look at how to use the exec function.
Exec ()Prototype:
The Code is as follows:
Copy code
String exec (string command [,
Import a third-party application member table to the ucenter memberfields table
Mysql tutorial _ connect ('localhost', '2017-cn', '0731licheng1 ') or die ('sever ');Mysql_select_db ('1970-cn') or die ('database error ');$ SQL = "select uid from
2008-01-24 00:00:00
//
This article was originally written on this site: www.drise.cn
Author: www.drise.cn
Reprinted Please note: From www.drise.cn
Qq: 271728967
//
When I got up early, I suddenly saw that someone on my website was messing up. To
A php Random Password generator program found on a foreign website. You can first define the base number, and then use mt_rand and substr to obtain the nth character.
Randomly generated password: m1ztpxw8
The Code is as follows:
Copy
Yesterday, to determine the source of the user's IP address, and then enter the address of the CIDR block where the user's IP address is located, we need to implement the function of converting the IP address and the integer type. Let's take a look.
PHP has several common functions for executing system commands, such as system functions, exec functions, popen functions, passthru, and shell_exec functions. They can all execute system commands, however, the system must have granted the required
In php, we usually replace all the specified characters in the replacement string at a time, such as the str_replace function, but sometimes we only want to replace the first occurrence, such as replacing the keyword in the article, if there are 100
I have talked a lot about how to get the extension name of a file. Today we will summarize how to use different functions to obtain the extension name. If you need it, please refer to it.
One, php explode function, function usage reference
For example, you must select the 3,000th-page records in tbllendlist, with 100 records on each page.----------Method 1:----------Select top 100 * from tbllendlistWhere fldserialNo not in(Select top 300100 fldserialNo from tbllendlistOrder by
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