PHP provides a simple method for downloading files

PHP provides a simple method for downloading files Function download_file ($ file ){ If (is_file ($ file )){ $ Length = filesize ($ file ); $ Type = mime_content_type ($ file ); $ Showname = ltrim (strrchr ($

Php implements base64 encoding and decoding

Php implements base64 encoding and decoding Class encryptCalss { Var $ key = 12; Function encode ($ txt ){ For ($ I = 0; $ I $ Txt [$ I] = chr (ord ($ txt [$ I]) + $ this-> key );

PHP calculates the size of a folder.

PHP calculates the size of a folder. Function dirSize ($ directoty ){ $ Dir_size = 0; If ($ dir_handle = @ opendir ($ directoty )) { While ($ filename = readdir ($ dir_handle )){ $ SubFile = $ directoty.

PHP format the numbers in RMB with commas (,) for each three digits

PHP format the numbers in RMB with commas (,) for each three digits Function num_format ($ num ){ If (! Is_numeric ($ num )){ Return false; } $ Rvalue = ''; $ Num = explode ('.', $ num); // separate

Php file read/write

Php file read/write $ Handle = @ fopen ("demo.txt", "r "); If ($ handle ){ While ($ buffer = fgets ($ handle, 4096 ))! = False ){ Echo $ buffer; } If (! Feof ($ handle )){ Echo "Error:

PHP calculates the length of time between two timestamps.

PHP calculates the length of time between two timestamps. /** * Returns the time of the two time ranges, * minute * second, * YEAR * month * Day * hour * minute * second * @ Param int $ one_time time 1 * @ Param

PHP converts Chinese characters to integer numbers, for example, one hundred and one to 101.

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

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 implements http login verification

Php implements http login verification /* Http authentication Determine the origin page Write logs */ //// // Disable the error report ////////////// Error_reporting (0 ); //// // Http

PHP processes Checkbox check box form submission

PHP processes Checkbox check box form submission Add [] to the name of the PHP form submission page check box so that the correct result can be obtained on the receiving page. After the form is submitted, an array is obtained, and the

Php parses web pages and downloads images to a local device

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.

Convert the time to the format of a few days ago or hours.

Convert the time to the format of a few days ago or hours. Convert the time to several days ago and hours, for example, "1 day ago" or "2 months ago. Function prettyDate ($ date ){ $ Time = strtotime ($ date ); $

Php uses cookies to record the number of visits

Php uses cookies to record the number of visits $ F_open = fopen ("count.txt", "r +"); // open the specified file $ Count = fgets ($ f_open); // read data from the file If (empty ($ _ COOKIE ['cookie _

PHP calls the http interface

PHP calls the http interface // Http request interface Function curl_http_request ($ param, $ url) { $ Ch = curl_init (); $ Curl_url = $ url ."? ". $ Param; Curl_setopt ($ ch, CURLOPT_URL, $ curl_url );

PHP code output as an image

PHP code output as an image $ Query = "select count (ip) as count_ip from tb_count04 "; // Query the total IP access volume in the database $ Result = mysql_query ($ query ); $ Countes = mysql_result ($

Php code for reading and writing cookies

Php code for reading and writing cookies Setcookie ('mycooker', 'value ');// Function prototype: int setcookie (string name, string value, int expire, string path, string domain, int secure)Echo ($ mycookie );Echo ($ HTTP_COOKIE_VARS

Php code for calculating the file size

Php code for calculating the file size Function dirSize ($ directoty ){ $ Dir_size = 0; If ($ dir_handle = @ opendir ($ directoty )) { While ($ filename = readdir ($ dir_handle )){ $ SubFile =

PHP retrieves the first letter of a Chinese string

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

Quick introduction to PHP webpage content capturing skills

Quick introduction to PHP webpage content capturing skills How can we capture webpage content in php correctly? This problem is difficult for friends who have been familiar with PHP soon. The course subject introduced the specific solution

Php type conversion

Php type conversion You can use type conversion to convert the value of a variable to another type. This type conversion is the same as that in C language. You only need to insert the temporary data type to be converted in parentheses

Total Pages: 12780 1 .... 12032 12033 12034 12035 12036 .... 12780 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.