Code implementation of four basic sorting algorithms in PHP
Many people say that algorithms are the core of a program. the quality of algorithms determines the quality of the program. As a beginner phper, although seldom touched on
Php computing page execution time code
Class c_Timer {
Var $ t_start = 0;
Var $ t_stop = 0;
Var $ t_elapsed = 0;
Function start () {$ this-> t_start = microtime ();}
Function stop
PHP compressed image
Function scale_dimensions_within_limits ($ w, $ h, $ max_w, $ max_h ){
// $ W is the width of the current rectangle
// $ H is the height of the current rectangle
// $ Max_w is the maximum width
Php obtains the user's real IP address
If a user uses a proxy server, the real ip address is not in the HTTP_CLIENT_IP header, but needs to be resolved through the http header HTTP_X_FORWARDED_FOR. The following php functions:
Php extracts the main color of the image
$ I = imagecreatefromjpeg ("image.jpg ");
For ($ x = 0; $ x
For ($ y = 0; $ y
$ Rgb = imagecolorat ($ I, $ x, $ y );
$ R = ($
Limit file download speed php code
The following code limits the download speed in php:
/* Source: http://www.apphp.com/index.php? Snippet = php-download-file-with-speed-limit */
/* Set here a limit of downloading
Common methods for exporting Excel files using PHP
/**
* Export data to an excel table
* @ Param $ data: A two-dimensional array with a structure similar to the array found from the database
* @ Param $ title the
Php code for traversing all files and folders in a folder
Php traverses all files and folders in a folder
Function list_dir ($ dirpath ){
If ($ dirpath [strlen ($ dirpath)-1]! = "\") {$ Dirpath. = "\\";}
Static $ result_
PHP ultimate encryption function
// F (ucking) u (ncrackable) e (ncryption) function by BlackHatDBL (www.netforme.net)
Function fue ($ hash, $ times ){
// Execute the encryption (s) as frequently times as the user wants
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 array to generate CSV files
A very simple function, from a PHP Group to generate a. csv file. This function uses the built-in fputcsv PHP function to generate comma-separated files (. CSV ). This function has three parameters: data,
Common php regular expressions
Class Verify {
/**
* Verify the user name
* @ Param string $ value
* @ Param int $ length
* @ Return boolean
*/
Public static function isNames ($ value, $
Upload PHP images and generate thumbnails
/**
* Upload images
*/
Class imgUpload {
Static protected $;
Protected $ formName; // form name
Protected $ directory; // upload a file to a directory
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 '];
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