Php shows the implementation code just a few minutes ago by time
This article describes how to use php to determine based on time to display the code just a few minutes ago and a few hours ago. For more information, see.Determine the time
Php file cache data class code sharing
This article shares a php file cache data Class, which is well written in a standard way and is followed by call examples. For more information, see.Speaking of php file caching, I reviewed the
Differences between include and require in PHP
If ($ something ){
Include ("somefile ");
}
Example 2: no matter what value $ something takes, the file somefile will be included in the file:
If
Php code sharing for crawling spider traces
This article describes how to use php to capture Spider traces. For more information, see.Use php code to analyze spider crawlers in web logs. the code is as follows:
'Googlebot ', 'baidu' =>
Php function ob_start () for browser cache control
Ob_start (); // open the buffer
Echo \ "Hellon \"; // output
Header ("location: index. php"); // redirects the browser to index. php.
Ob_end_flush ();
Php regularly generates static html code sharing
This article describes how to use php to regularly generate a static html homepage. For more information, see.Use php to regularly generate static pages.The code is as follows:
start(
How to execute the cmd command in PHP
Exec ("mkdir d: \ test", $ out );
Print_r ($ out );
?>
Run the php file and you will find a test folder added to drive D.Reference: exec function parsing
Phpgetdate function usage example
$ A = getdate ();
Printf ('% s % d, % d', $ a ['month'], $ a ['mday'], $ a ['Year']);
?>
2. getdate () uses the specified timestamp
$ A =
Example of using the number_format function
Print number_format (100000.56 );
?>
Example 2: number_format ($ n, $ p, $ t, $ d) rounds $ n to $ p decimal places, using $ t as the thousands separator and $ d
PHPget_class () function usage example
Class Foo {
Function name_none_static (){
Echo "My name is". get_class ()."";
Echo "My name is". get_class ($ this )."";
}
}
// Class
Example of phpsqlite_create_function
/**
* Sqlite_create_function example
* Edit: bbs.it-home.org
*/
Define ("PPO", 400 );
Function my ($ salary ){
Return $ salary/PPO;
}
Example of PHPheader function usage
Header ("Location: http://bbs.it-home.org ";);
Exit; // after each redirection, you must add "exit" to avoid errors and continue execution.
?>
Header
What should I pay attention to when uploading files in php?
Upload the attachment:
Tip: you can use upload_max_filesize in php. ini to set the maximum value allowed to upload files.In addition, there is
PHP code used to query the prvalue of a website
/*
* Function: encode the URL
* Parameter description: $ web_url URL, excluding "http ://"
* Site: bbs.it-home.org
*/
Function HashURL ($ url)
Difference between or and | AND & amp; in php
$ P = 6 or 0;
Var_dump ($ p); // int (6)
$ P = 6 | 0;
Var_dump ($ p); // bool (true)
$ P = 6 and 0;
Var_dump ($ p); // int (6)
$
POP3 class implemented by PHPSocket
/**
* PHP Socket POP3 class
* By bbs.it-home.org
*/
Class SocketPOPClient
{
Var $ strMessage = '';
Var $ intErrorNum = 0;
Var $
Php obtains the googlepr value of the website.
/**
* The php code gets the prvalue of the website.
* By bbs.it-home.org
*/
$ Googlehost = "toolbarqueries.google.com ";
$ Googleua = "Mozilla/5.
Usage of php array (Arrays)
This article introduces some knowledge about php arrays as a reference for getting started with php arrays.I. php array definitionThe php array indicates a group of associated data.In PHP, array () is used to
Getting started with php array
This article introduces how to evaluate the difference set of php arrays. For more information, see.In php, evaluate the difference set of the array.The difference set function of the array is used: array_diff
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