/*** Topic: Create and parse XML files using PHP DOM-XML* Source: http://www.php.net/domxml* Reference: http://www.zugeschaut-und-mitgebaut.de/php/extension.domxml.html* Author: urs@circle.ch, 16-1-2001* */// Use the PHP DOM-XML to create and parse
Most of the thumbnails generated by the website are scaled in proportion. Let's take a look at the fixed image size today. "> the image size will automatically fill in the blank space if it is not enough. For more information, see. Error_reporting
$ Oimg = "test.jpg"; // original image name$ Classes = array ('translation', 'autoheight', 'autowidth', 'stretch '); // give classes for the new creating images 'size which are defined in the specified ini file$ Suffix = 'jpg '; // the new image's
I used getimagesize to get the size of the original image, and then x0.5 is to set the image/5.Array getimagesize (string $ filename [, array & $ imageinfo])The getimagesize () function will determine any gif, jpg, png, swf, swc, pstutorial d, tiff,
The code is as follows:Copy code $ Newimg = imagecreate (250,250 ); Because the image is still blank, you may want to fill it with some color. You must first use the imagecolorallocate () function to specify a name for this color with its rgb
. Jpgraph open source project introductionJpgraph is a function library for creating object-oriented graphs. It can be used to generate commonly used charts, such as bar charts, pie charts, Gantt charts, and mesh charts. Supported image formats
// You do not need to alter these functions The code is as follows:Copy code Function getheight ($ image ){$ Size = getimagesize ($ image );$ Height = $ size [1];Return $ height;} // You do not need to alter these functions The code is as
In fact, the strtotime function of php is mainly used, strtotime ('N day'). The example is as follows: The code is as follows:Copy code $ Days = array ();For ($ I = 0; $ I $ Days [] = date ("Y-m-d", strtotime ('-'. $ I. 'Day '));}Echo ''; print_
When writing the form verification class of the framework tonight, you need to determine whether the length of a string is within the specified range. Naturally, you think of the strlen function in PHP. The code is as follows:
To merge the simplest arrays, we only need to use array_merge.Array_merge () combines two or more arrays. The values in an array are appended to the values of the previous array. Returns an array of results.When the array KEY name is a numeric KEY,
Php writes arrays to files through sequences and reverse sequences. Please refer to the code$ File = "./data/file. cache ";File_put_contents ($ file, serialize ($ array); // write cache The code is as follows:Copy code $ File = "./data/file.
Call mt_rand () to generate a random number. The parameter is the minimum and maximum values of the range. The function returns a random number between the minimum and maximum values.Generating real random numbers is not easy for calculation.In php,
Example The code is as follows:Copy code $ A = 1;$ B = 2;Function Sum (){ Global $ a, $ B; // declare it as a global variable$ B = $ a + $ B;} Sum ();Echo $ B;?> Result: 3If no global variable is available, the values $ a and $ B cannot be
Method: Create a php file, and then throw the following code to save it as example: your cut. php and put it in the website and directory. The code is as follows:Copy code $ ShortCut = "[InternetShortcut]URL = http://www.111cn.netIDList =[{00021
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