This article mainly introduces some common function collection in PHP, this article collects some time date, output print, common string function, commonly used array method, need friend can refer to the following
?
1 2 3 4 5 6 7 8 9 10
Today, while testing a PHP program, I found this problem:
Forbidden
You don ' t have permission to access/on this server.
At the beginning I was using http://localhost/test.php to carry out the test, did not find the problem, and then to be
Write recursive functions, you can consider caching, it is helpful to define a number of static variables to save the results of the last run. The approximate steps are: first to the database, to an array, then to the data into a tree-shaped array,
can only be accessed in a limited range of IP addresses
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
function get_real_ipaddress () {if!empty ($_server[' Http_c Lient_ip ']) {return $_server[' http_client_ip '];
GoDaddy mainframe in foreign countries. Put the site outside the station, show time may need time zone conversion, the following is a convenient tool function for time zone conversionThe code is as follows: * * Time zone conversion/function
Subtraction Calculator Presumably everyone has used it, this article for you to introduce how to implement the use of PHP, the following has a good example, interested friends can refer to the following Implement the subtraction calculator in
(1) PHP retains three decimal places and rounded
The code is as follows
$num = 0.0215489;Echo sprintf ("%.3f", $num); 0.022
(2) PHP keep three decimal digits not rounded
The code is as follows
All the time in the project shows the 2014-10-20 10:22 looks very stiff. In micro-blog, QQ space and other sites will usually show a few seconds ago, a few minutes ago, hours ago, such as easy to read time, we call it a friendly time format. So how
Ob_start ([string output_callback])-Open output buffer
All output information is not sent directly to the browser, but is stored in the output buffer, which is used to process output information.
Ob_end_flush-End (send) the contents of the output
This article mainly describes how to solve the problem of PHP can not upload more than 8M files, the need for friends to refer to the nextDevelop a file upload share site, once wanted to use the following code to implement the file upload function:
Every time you use curl, you always have to look up a bunch of data.
Now will be used to save a few sentences, the province every time to go to Google.
General Curl Request:
The code is as follows
$url = '
This article mainly introduces the PHP empty function in the detection of a non variable case of the solution to the error, the need for friends can refer to thePHP development, when you use empty to check the results of a function returned error:
In ASP.net and Java have shared memory, PHP, in addition to the use of memcached, and other ways in fact, PHP is also supporting shared memory, the following use SHMOP to achieve this function need to install extension SHMOP Locate the PHP
This article mainly introduces the use of Get_object_vars () method in PHP, the example analyzes the Get_object_vars () method to get the attributes of the object, the need for friends can refer to the
This article analyzes the use of the
This article mainly introduces the PHP implementation of the addition and subtraction verification code code, you can use the addition and subtraction within 10 to generate pictures, the need for friends can refer to the following Code is as
What is the scope of a variable? The scope of a variable refers to the valid range of variables within a lifetime of a script. Generally, there are global and local points The scope of variables in PHP can be divided into: Super Global (the
This article mainly introduces PHP using reflection Insert Object example, need friends can refer to the following Code as follows:/** * Insert Insertmodel (), use reflection, slightly less efficiency * @param class $model object &nbs P *
This article mainly introduces the PHP traversal folder and file list examples, the need for friends can refer to the following For PHP traversal directory and file list wrote a simple class, and attached to the use of examples, we refer to the
This article mainly introduced the PHP traversal deletes the entire directory and the file method, involves the PHP operation directory and the file skill, has certain reference value, needs the friend to be possible to refer to under
This article
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