The mimetype type of the file obtained by PHP
/**
* Obtain the mime type of the object.
* @ Author xiaobing. meng
*
*/
Class MimeTypes {
Public static $ mime_types = array (
'Apk '=>
PHP: a common method for downloading images
Function getPicture ($ url, $ pictureName ){
If ($ url = "") return false;
// Obtain the image extension
$ Info = getimagesize ($ url );
$ Mime = $ info ['Mime '];
Example of using file cache in php
In web development, you can use file caching to greatly relieve the pressure on the database. The following code is an example of using file caching in php. CacheLayer. php
Class
PHP: how to obtain letters on the Chinese homepage
Function getfirstchar ($ s0 ){
$ Fchar = ord (substr ($ s0, 0, 1 ));
If ($ fchar> = ord ("a") and $ fchar = ord ("") and $ fchar
$ S = iconv ("UTF-8", "gb2312", $
PHP converts Chinese characters to integer numbers, for example, one hundred and one to 101.
Test ();
/**
* Test
*/
Function test (){
Echo CnToInt ('1'); // 1
Echo CnToInt ('10'); // 10
Echo
PHP code for common MongoDB operations
$ Conn = new Mongo ();
// Can be abbreviated
// $ Conn = new Mongo (); # connect to the local host, default port.
// $ Conn = new Mongo ("172.21.15.69"); #
Php parses web pages and downloads images to a local device
// Error_reporting (0); // Close the error report
Include_once ("simple_html_dom.php"); // introduce the parsing library
$ Url = 'http: // www.
Traditional and Simplified PHP functions
Class utf8_chinese
{
Private $ utf8_gb2312;
Private $ utf8_big5;
Private $ data;
Public function _ construct ($ data ){
$ This-> utf8_gb2312 = $ data ['
PHP retrieves the first letter of a Chinese string
$ Limit = array (// gb2312 pinyin sorting
Array (45217,45252), //
Array (45253,45760), // B
Array (45761,46317), // C
Array (46318,46825), // D
The function of the IP address of the other party is automatically blocked when CC or DDOS attacks occur.
This function is used to count the total number of visits per visitor in a short period of time. if the limit is exceeded, TRUE is
Beautiful PHP verification code
Class Page {
Private $ total; // total records
Private $ pagesize; // The number of entries displayed on each page
Private $ limit; // limit
Private $ page; // The
Record page execution time php code
Class runtime
{
Var $ StartTime = 0;
Var $ StopTime = 0;
Function get_microtime ()
{
List ($ usec, $ sec) = explode ('', microtime ());
Return
Php randomly generates a password that is easy to remember
Function random_readable_pwd ($ length = 10 ){
// The wordlist from which the password gets generated
// (Change them as you like)
$ Words = 'Dog,
PHP is a friendly function parameter passing mode design
PHP is a friendly function parameter passing mode design. if you need it, you can refer to it. When many parameters need to be input in a constructor of a class, programmers may
Php --- ajax transmits multi-dimensional arrays to the background
Php --- ajax transmits multi-dimensional arrays to the backend. For more information, see.1 traditional: true?? The online data is generally set to true as the ajax parameter
Php learning: Learn more about PHP7
This PHP study will give you a deep understanding of the special characteristics of PHP 7. What are the differences between PHP 7 and other versions? what are the advantages? The performance breakthrough
Php (basic, variable, constant, structure statement)
Php beginners (basic, variables, constants, structural statements). If you need them, refer.Basic knowledge:?> It can be omitted that the string connector is. annotation // variableThe
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