Before discussing how to use namespaces, you must understand how PHP knows which namespace elements to use. You can make a simple analogy between the PHP namespace and the file system. There are three ways to access a file in the file
If no namespace is defined, all classes and functions are defined in the global space, as before the introduction of the namespace concept in PHP. Precede the name with a prefix \ means that the name is the name in the global space, even if the name
Directory functions
chdir-Changing directories
chroot-Changing the root directory
closedir-Closing a directory handle
Dir-return an instance of the Directory class
Getcwd-get Current working directory
opendir-opening a directory
n ways to get file name extensions in PHP
Acquisition from the Internet, basically the following ways:
The 1th method:
function Get_extension ($file)
{
substr (STRRCHR ($file, '. '), 1);
}
The 2nd method:
function Get_extension ($file)
{
Return
PHP 5 adds exception handling modules similar to those in other languages. Exceptions generated in PHP code can be thrown by a throw statement and captured by a catch statement. The code that requires exception handling must be placed inside a try
Note: The generator is supported in PHP5.5 and later versions.
The generator provides an easier way to implement simple object iterations without the performance overhead and complexity of implementing a class with a Iterator interface.
The
When a generator function is called for the first time, an internal generator class object is returned. This object implements the iterator interface in almost the same way as the foreground iterator object.
Most of the methods in the Generator
The number of repetitions is specified by quantifiers and can be followed immediately after the following elements:
A single character, which can be escaped.
Metacharacters
Character class
Back reference (Join the next section)
Sub-group (unless it
Before the development project, encountered the use of Strtotime ("-1 months") will be a bug, mainly because the default PHP time is set in Greenwich time zone standard, there are two ways to solve this problem, one is to modify the default time
Often in some of the PHP open source system, see the backup database and export methods, in fact, the code is not complex, the following
About the following, take windows as an example, two kinds of methods, one is the directory folder to execute
Text (explanation see code comment)
I, substr () && strlen ()
Code:
'; Output original Value $ A. = $b; Append the value of $b to $ A/** * $b get a $ A value in detail: * The length of the string in $ A and $b is calculated first by strlen ()
PHP transparently supports HTTP cookies. A cookie is a mechanism for storing data on a remote browser to track and identify users. You can use the Setcookie () or Setrawcookie () function to set the cookie. A cookie is part of the HTTP header, so
Should we choose pseudo-static or true-static?
1, the use of true static and false static for SEO no difference
2, the use of true static may cause hard disk damage and will affect the performance of the Forum
3, use pseudo-static will occupy a
PHP 5 can use type constraints. The parameters of the function can specify that the object must be (the name of the class specified in the function prototype), interface, Array (PHP 5.1), or callable (PHP 5.4). However, if you use NULL as the
A persistent database connection is a connection that is not closed when the script finishes running. When a request for a permanent connection is received. PHP will check to see if there is already an identical persistent connection (previously
The practice of counting the number of open messages is basically to put a picture in the message and then count the number of times the picture is opened
Mail.html
This makes it possible to log statistics to the number of times a picture is
PHP has been a very important and fast and convenient development language in the field of web development, favored by the vast number of developers. Now the official version of PHP 5.4 has been released, adding a lot of new features, officially
Class SMTP
{
/* Public Variables */
var $smtp _port;
var $time _out;
var $host _name;
var $log _file;
var $relay _host;
var $debug;
var $auth;
var $user;
var $pass;
/* Private Variables */
var $sock;
/* Constractor */
function smtp ($relay _host = ""
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