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
$_server:http://www.php.net/manual/zh/reserved.variables.server.php
$_env:http://www.php.net/manual/zh/reserved.variables.environment.php
$_post, the data in $_get can be obtained through $_request, but $_request is slower than $_get and $_post.
1. Timed execution
On the crontab, Linux commands, how to use, their own Google. Just to say, crontab need to pay attention to the permissions, operations are often started with root, resulting in some files Web users do not have permissions.
2.
Functions are a powerful source of PHP, but many PHP functions are not fully utilized. Here, we give you a brief introduction to 10 less common, but very useful functions.
1. Sys_getloadavg ()
SYS_GETLOADAVT () can obtain the system load condition.
By setting the Content-type to Application/octet-stream, the dynamically generated content can be downloaded as a file, which we believe will be. Then use the Content-disposition settings to download the file name, this also has a lot of people know
Constructors ¶
Void__construct ([Mixed$args [, $ ...]])
PHP 5 allows the developer to define a method as a constructor in a class. Classes with constructors Call this method each time a new object is created, making it ideal for doing some
PHP 5 supports abstract classes and abstract methods. A class that is defined as abstract cannot be instantiated. Any class, if at least one of its methods is declared abstract, then the class must be declared abstract. A method that is defined as
1. Variable function name, you can use string to splice function name
function AA ($STR) {echo $str;} $function = "AA"; $function (' Hello ');//Orcall_user_func ($function, $param);
2. List all functions to determine if a function exists
PHP intercepts Chinese strings, generally based on whether the value is greater than or equal to 128来 to determine whether it is a double-byte character, in order to avoid the interception of incomplete and garbled situation.
However, when it comes
General anti-injection, as long as the use of PHP addslashes function is possible.
PHP code
$_post = Sql_injection ($_post);
$_get = Sql_injection ($_get);
function Sql_injection ($content) {
if (!GET_MAGIC_QUOTES_GPC ()) {
if (Is_array
curl_init-initialization of a curl session
curl_copy_handle-Copy all the contents and parameters of a Curl connection resource
curl_errno-returns a numeric number that contains the current session error information
curl_error-returns a string
The benefit of the WEB is the ability to share information and services. The downside is the ability to share information and services, because some people do things without scruple.
Take the form as an example. Anyone can access a Web site and use
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
"; echo Date ("Y-m-d h:i:s", $d);//24 hours before the time echo ""; $c =mktime ();//current timestamp value echo date ("y-m-d h:i:s");//Current time echo ""; echo $c;//Current timestamp value echo ""; Echo (Strtotime ("+5 hours")); 5 hours after
Failure phenomena:
Prompt error message when you start Apache in command mode "Syntax error on line 122 of D:/apache/conf/httpd.conf:cannot load D:/php/php5apache2_2.dll into s Erver ", causing Apache to fail to start.
Apache configuration file
In PHP, __sleep and ___wakeup are two separate methods that are called before and after the object is serialized,
Where __sleep is called before an object is serialized, it does not receive any arguments, but returns an array where the properties
1, $_server["php_self"]--Get the file name of the currently executing script
2, $_server["Server_protocol"]--the name and version of the communication protocol when the page is requested. For example, "http/1.0".
3, $_server["Request_time"]--the
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