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 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 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 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 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 =

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

Php forced type conversion

Php forced type conversion Forced type conversion in php usually occurs in the environment where arithmetic operators are involved. arithmetic operators are common numeric operators. The operated content is generally called an operation

Intercepting Chinese string PHP code

Intercepting Chinese string PHP code /** * * Chinese string truncation * @ Param string $ string * @ Param int $ sublen * @ Param int $ start * @ Param string $ code */ Function substr_zh ($

Generate verification code and randomly interfere with php implementation

Generate verification code and randomly interfere with php implementation Session_start (); Header ('content-type: image/png '); // Create an image $ Im = imagecreate ($ x = 130, $ y = 45 ); $ Bg =

PHP code without deformation screenshot

PHP code without deformation Function my_image_resize ($ src_file, $ dst_file, $ new_width, $ new_height) { $ Src_img = imagecreatefromjpeg ($ src_file ); $ W = imagesx ($ src_img ); $ H = imagesy ($

Obtains the last day of a month or the number of days of a month.

Obtains the last day of a month or the number of days of a month. // Obtain the last day of a month or the number of days of a month Function getMonthLastDay ($ month, $ year) { Switch ($ month) { Case 4:

Binary search PHP implementation

Binary search PHP implementation /** Binary search: searches for the position of a value in the array. * @ $ Arr: array of operations, provided that they are arranged in order * @ $ Val: the value to be searched.

PHP Singleton mode code

PHP Singleton mode code Class User { Static function getInstance () { If (self: $ instance = NULL) {// If instance is not created yet, will create it. Self: $ instance = new User (); } Return self: $

Use regular expressions to check whether tags are disabled

Use regular expressions to check whether tags are disabled Function check_html ($ html ){ Preg_match_all ("/] *>/", $ html, $ start_tags ); Preg_match_all ("//", $ html, $ end_tags ); If (count ($ start_tags [1])! =

Total Pages: 12780 1 .... 12531 12532 12533 12534 12535 .... 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.