Magic variable
PHP provides a large number of predefined constants to any script it runs.
However, many constants are defined by different extensions, and are only available when the extensions are loaded, either dynamically or at compile time.
Cases:
Copy Code code as follows:
$a = fopen (' test.txt ', ' R ');
There is no decision on the file to open, if the file does not exist will be an error
?>
The correct wording should read as follows:
Copy Code
Usually read the error log PHP, very few opportunities to write their own log, saw Wang Jian's "Best log Practice" that write a clear, structured log is still very necessary.
Before writing a journal, we ask ourselves: why do we sometimes have to
Understanding Crypt ()
As long as you have a bit of experience with a non-Windows platform may be familiar to crypt (), this function is called one-way encryption function, it can encrypt some of the code, but can not reverse the password back to
The example of this article summarizes the common checking function of PHP user registration. Share to everyone for your reference. The specific analysis is as follows:
PHP user registration commonly used in a number of commonly used test function
This paper analyzes the solution of PHP prompt failed to write session data error in detail. Share to everyone for your reference. The specific methods are as follows:
First, the question:
Prompt message:warning:failed to write session data (files)
Today looked at the WordPress code, there are some rare php substitution syntax,
Copy Code code as follows:
→ ', ' Thebox ')?>
' '. __ (' pages: ', ' Thebox '), ' after ' => ' ));?>
What does the colon and
In front of the
In the article, we mentioned that the Strtotime function is going to be a bit of a situation when you use Strtotime ("-1 month") for one months today.
So it also leads to writing this article, which includes the following:
some
1. DOM function
A, Domdocument->load ()Function: Load XML fileUsage: domdocument->load (string filename)Parameters: Filename,xml file;Return: Returns TRUE if successful and FALSE if failed.
B, Domdocument->loadxml ()function: Load XML codeUsage:
1. Custom Constants
* Must be defined with function define ()* The value can not be changed after the definition is finished* Use the constant name directly, not as a variable in front plus $sFor example: Define ("PI", 3.14); Define a constant$area
The example in this article describes the way PHP gets mail based on IMAP. Share to everyone for your reference. The implementation methods are as follows:
IMAP is a mail interactive access protocol, the following is an example of the main use of
Situation 1:
Father.php is defined as follows:
Copy Code code as follows:
$jack = 1000;
?>
Children.php is defined as follows:
Require ("father.php");
$jack = 123;
echo $jack. " /n ";
?>
PHP children.php
Run the
A Memory Overflow SolutionWhen doing statistical analysis of data, often encounter large arrays, memory overflow may occur, here to share my solution. Use examples to illustrate the problem, as follows:Assuming that the log holds 500,000 records,
The floor function and the Ceil function match each other to make PHP processing data more authentic and reliable.
First, look at the floor function:
Grammar:
Float floor (float value)
Description
Returns the next integer not more than value,
With. NET development has been 5 years, recently suddenly want to contact. NET, so let's take a look at PHP. In learning PHP, first look at a few output functions.
First, EchoEcho () is not actually a function, it is a PHP statement, so you do not
Many programmers in the development of PHP have encountered a blank page, comprehensive analysis, in PHP programming in the presence of blank pages may be caused by the following several reasons:
1. Logic Error
Logic errors are the hardest to rule
The solution is to find the location of the error and then see which variable is not initialized and use it directly, and instantiate the variable first as an empty class. Such as:
Copy Code code as follows:
$CT = new StdClass ();
Modify
Before we begin, we can look at a simple piece of code:
Copy Code code as follows:
$foo = 1;
$bar = $foo;
echo $foo + $bar;
?>
Executing this code will print out the number 2. From the memory point of view to analyze
A good PHP programmer in addition to the smooth writing code, but also need to make the program in a safe environment of the ability. Today we're going to talk about how PHP is preventing SQL injection.
When it comes to site security, you have to
1, what is a namespace?A namespace is a special scope that contains identifiers that are located under that scope, and which is itself an identifier. You can match the namespace to the directory of the operating system. A namespace is the equivalent
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