PHP to create a file method There are many of our most commonly used is fopen,file_put_contents these two methods to create a file, the following I will give you a detailed introduction, there is a need to understand the students can refer
Page execution time calculation is just a general process, we put the program's initialization function on the top of the page, and then put the calculation function at the bottom of the page, and then when the page is completed to calculate the
A netizen writes the city linkage PHP classification procedure, everybody may refer to the reference.
Write a function that will data
The code is as follows
Copy Code
$array = Array (0=>array ("", "Hebei"),1=>array ("",
First check if there are files in this directory, if there is a folder, then call this function to delete, if the file is directly called unlink Delete, and finally delete this directory.
The code is as follows
Copy Code
PHP DataSet build JSON and new arrays introduce a friend you need to refer to.
The code is as follows
Copy Code
function Recordtojson ($recordset){$jstr = ' [';while ($rs = $recordset->fetch ()){$nick = Iconv ("GBK", ' Utf-
Below I analyze the long article pagination and the article page program code, the need for friends can refer to.
Method one, according to the word control for paging
Page by word method is easy to use, but the effect is not good.
General idea:
This article describes the solution XMLHttpRequest (Ajax) cannot set a custom referer approach, we mainly use the server as a proxy. To deal with, is based on the Curl method Oh.
In PHP, use my favorite of the most powerful curl, hehe
Here is the
A segment of the classic code can be used to obtain the user's real IP address, including can be intranet or external network, the need for friends can refer to.
The code is as follows
Copy Code
/*** Get the real IP address
PHP Gets the content implementation code between the specified characters, which is a substring that gets between the two substrings in the string, such as getting the Hzhuti substring from the string www.hzhuti.com, let this PHP function be
There are a number of rounding functions in PHP, including round (), ceil (), floor (), and so on, with a reference to a friend in need.
The code is as follows
Copy Code
$s = rand (100,200);$pi =pi ();$r =sqrt
This is a good code and speed from the PHP directory traversal code, the need for friends can refer to.
The code is as follows
Copy Code
$path = ' ... ';function Get_filetree ($path) {$tree = Array ();foreach (Glob ($path.
Multi-File upload is a basic application in PHP, anyway Phper will encounter problems, now introduce a fully functional, powerful multi-file upload class to everyone, can use this kind of place will be a lot
。
The code is as follows
PHP in the development of the timeline, that is displayed as "just", "5 minutes Ago", "Yesterday 10:23" and so on, the need for friends can refer to.
code as follows
copy code
function trantime ($time) { $rtime =
An experienced friend may know that when using a library like QQIP, the IP address we find is a bunch of numbers, and let's show you how to implement a digital method for converting IP addresses.
The code is as follows
Copy Code
The article is the author of an original article on the implementation of the Infinite class in PHP classification, there is a need to understand the friends can see.
Infinite classification is like a new folder under Windows, under the new folder
In PHP we have to sort one-dimensional arrays so that we can simply use sort (), rsort (), so we're done, and if we want to sort the multidimensional data, PHP doesn't have this kind of function.
For PHP array ordering in PHP provides a lot of
In the php+mysql to achieve a relatively simple paging, as long as the page and then x a few records and then use limit n,m can be the perfect realization of paging, this example is very clear that the need to refer to the classmate.
Project
Used to use JS to the instance chat room or no refresh output, in fact, PHP can be implemented separately Oh, in PHP we use Flush () Ob_flush () can be.
Ob_end_clean (); Clear the output cache and close the cacheEcho Str_pad (', 256);//output
The article is very simple two instances of PHP directory creation and recursive unlimited creation and deletion of the directory function, the need for friends can refer to, we use Mkdir,rddir to instance.
Here is the program code:
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