At the beginning of this article, the author assumes that the reader has been able to write a user's login authentication program.
----------------------------------------------------------
Registers can complete the total number of times to access
Method 1 The code is as follows:Copy code If (preg_match ("/^ d * $/", "4312 ")){Echo "all numbers";}If (preg_match ("/^ [a-z] * $/I", "fdsFDfd ")){Echo "all letters";}If (preg_match ("/^ [a-zd] * $/I", "fd4fd34 ")){Echo "has numbers and letters"
Let's look at the problem first.File_get_contents cannot obtain the URL with PortFor example: The code is as follows:Copy code File_get_contents ('http: // localhost: 100 '); There is no get.Solution: disable selinux.1 Permanent method-server
The following is an example of using the autoload mechanism to load the Person class: The code is as follows:Copy code /* Autoload. php */Function _ autoload ($ classname ){Require_once ($ classname. "class. php ");} $ Person = new Person
Modify php. ini. Open php. ini, find date. timezone, remove the semicolon = followed by XXX, and restart the http service (such as apache2 or iis).For XXX, the available values in mainland China are: Asia/Chongqing, Asia/Shanghai, Asia/Urumqi (in
SolutionFirst, change display_errors = on of php. ini to display_errors = off (no error is displayed)Method 2: convert allow_call_time_pass_reference = Off to allow_call_time_pass_reference = OnThe above is to modify php. ini, but if you do not have
Let's add a counter to the homepage. It is helpful to demonstrate how to read and write files and create your own functions. Counter. inc contains the following code: The code is as follows:Copy code /*| A simple counter*/Function get_hitcount ($
Once a constant in PHP is defined, it cannot be changed or undefined. Constants have predefined constants (internal constants) and default PHP constants, you can also customize constants.The following are some predefined constants: (For details,
PHP stringsA string variable is used to include the value of a string.In this tutorial, we will introduce several of the most common functions and operators used to operate strings in PHP.After creating a string, we can operate it. You can use a
The operator is used to calculate the value.PHP operatorsThis section lists various operators used in PHP:Arithmetic operators Operator Description Example Result +
The loop in PHP mainly refers to the number of times specified by the user to run the same code block.There are four main PHP loops: while, do... While, for, foreach. Next we will explain the usage of each loop separately.While statement:The code
Once you download other people's source code, you can see countless @ marks and start to think it is a comment. Later, you will find that the @ statements will be executed. Wondering, what is this mark .....With the continuous development of
PHP Annotator■ C ++ style: // This is a C + style comment■ C style:/* This is a C style comment */■ Unix Shell style: # This is a Unix Shell style commentGenerally, '//' and '/* comment content */' are used. In addition, some system configuration
The previous section describes the MVC routing principle. In this section, we will talk about the MVC framework loader, also known as the loader.Although different frameworks and loaders have different usage, their principles are the same... All
We know that PHP needs to obtain the opened_path of the file to determine whether a file is loaded, which means, for example: The code is as follows:Copy code Set_include_path ("/tmp/:/tmp2 /");Include_once ("2.php ");?> When PHP sees
After connecting to the code, I don't know if it's a problem with php5.4, or is it like this... The code is as follows:Copy code $ A ['hello'] = '123 ';$ A ['XX'] = NULL; Var_dump (isset ($ a ['hello']); // bool (true) Var_dump (isset ($ a
Why does some php code end with "?>" What about it? I didn't know it at first, but Baidu only knew it later. When I look at tutorials online, other people have "?>" End the tag, but many others do not add the source code,In the past, the end tag was
The garbage collection mechanism used before php 5.3 is a simple "reference count", that is, each memory object is allocated with a counter. When the memory object is referenced by a variable, the counter is + 1; when the variable reference is
The setcookie () function is used to set the cookie.Note: The setcookie () function must be located before the tag.SyntaxSetcookie (name, value, expire, path, domain );See the instance below The code is as follows:Copy code // Cancel the
For a long time, it seems that the eval () function cannot be used for value assignment? Some articles on the Internet also said this!For example, eval ("$ a =;"); an error will be prompted for this formula!Is it true that the code executed by eval (
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