Building PHP environment is mainly divided into three steps, the first step is install Apache (2.4) Server: Before Apache is installed, you need to install the APR, Apr-util, and pcre dependencies, because Apache relies on them. The specific
User login system (no database)Key code:LoginUI. php mainly includes:--------------------------- The code is as follows:Copy code If (error! = Null ){$ Error = $ _ GET ['error'];Echo $ error;Echo "login failed. Please check your username (yugaga)
The traversal results are as follows:Program codeThe jquery file in index. php can be downloaded by Baidu, because this is used to achieve an effect. The code is as follows:Copy code Include ("function. php ");$ Path = "directory/"; // directory
Example, use mb_detect_encoding () to determine whether the character is uft-8 encoded. The code is as follows: Copy code $ Encode = mb_detect_encoding ($ q, array ('gb2312',
Csv file format The code is as follows:Copy code $ Exportdata = 'rule 111, valid period '. "\ n "; To output csv files in php, use the header to tell the browser format. The code is as follows:Copy code Header ("Content-type:
Method 1:First construct a number of 10000000, 10 million, that is, a 10000003 0, and then add the current number (for example, 3), then get 10000003, and use a string to intercept substr ('123456 ', 0000003). After splicing with "d", the final
Rawurlencode(PHP 4 and PHP 5)Rawurlencode-URL encoding according to RFC 1738DescriptionString rawurlencode (string $ str)Encode a specific string according to RFC 1738 of & raquo.ParametersStrEncode the URL.Return valueReturns all non-alphanumeric
The length of the field obtained by php mysql_field_len is the length of the value returned by mysql_query,Syntax:Mysql_field_len (data, field_offset)Data: required. The specified data pointer is used. The data pointer is generated from the
The most common function of array sorting is sort ($ arr). It is used to sort the key values of an array in ascending order, and the sorted array key name is no longer the original key name, is the key name reset by the new array.Sometimes we need
To analyze the problem, you need to call the data of A function (currently called function A) and have executed global $ _ G to call global variables, the $ _ G output through print_r also confirms that $ _ G contains data and the plug-in cache is
The first is the Ajax. Php file:I think this file is used to receive data for data processing. The code is as follows:Copy code Mysql_connect ("localhost", "root ","");Mysql_select_db ("aaa ");Mysql_query ("set names 'utf8 '"); I do not need to
The substr () function returns part of the string.SyntaxSubstr (string, start, length)Example 1 The code is as follows:Copy code Echo substr ("Hello world! ", 6 );?>Output:World! Example 2 The code is as follows:Copy code Echo substr
Use trim series functions to delete left and right spaces The code is as follows:Copy code Trim removes spaces at both ends of a string,Rtrim removes the right space of a string,Ltrim removes the left space of a string.Echo trim ("space"). "
Example The code is as follows:Copy code $ People = array ("Peter", "Joe", "Glenn", "Cleveland ");If (in_array ("Glenn", $ people )) {Echo "Match found "; }Else {Echo "Match not found "; }?> Output:Match found.Array_key_exists () functionIf
The code is as follows:Copy code /*** Check*/Class Check {/*** IsUsername function: checks whether the username format is correct.* $ Argv is the username parameter to be checked* $ RegExp is the regular statement to be checked* Return value:
1. Disable notice error prompt1. Change error_reporting in the php. Ini file.Changed: The code is as follows:Copy code Error_reporting = E_ALL &~ E_NOTICE 2. If you cannot operate the php. Ini file, you can use the following method:Add the
PHP Notice: Undefined variablePHP Notice: Undefined indexLet's take a look. You can directly use undefined variables. However, PHP compilation is not as strict as C ++, which is often used in programming. The default setting of PHP is to display
The syntax of the exception itself is not worth discussing. The exception usage scenario is the main one. Here I will compare php and java to see what the exceptions in php are and how they should be used.I saw this discussion on the PPC Forum and
The regular expression extracts the id from the URL The code is as follows:Copy code Preg_match ('/http://t.sina.com.cn/(d +)/fans //', $ html, $ result); regular expression extracts the id in the URLEcho $ result [1]; PHP regular expression to
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