Use PHP DOM-XML to create and parse XML files

/*** 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

The thumbnails generated by php can be automatically filled with spaces.

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

A php batch-generated thumbnail code

$ 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

Simple php image proportional scaling code

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,

A php code for generating verification codes

Session_save_path, you can redefine the directory.*/$ Sesssavepath = dirname (_ file _). "/../data/sessions /";If (is_writeable ($ sesssavepath) & is_readable ($ sesssavepath) {session_save_path ($ sesssavepath );}Session_start ();$ Vstr = '';For ($

Php GIF image watermarking code

The code is as follows:Copy code $ Imagedraw = new imagick ();$ Pixel = new imagickpixel ('gray ');$ Pixel-> setcolor ('black ');$ Imagedraw-> newimage (100, 75, $ pixel );$ Draw = new imagickdraw ();$ Draw-> setfont ('bookman-demiitalic ');$

Php creates an image instance

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

Php generates various statistical graph instances

. 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

Upload php images and generate thumbnails

The code is as follows:Copy code Function uploadimage ($ upname, $ smallmark = 1, $ dstsw, $ dstsh = 0, $ path_dim, $ path_xim, $ newname, $ smallname = 0, $ filetype = "null ") {Global $ webaddr, $ _ files, $ my;$ Phpv = str_replace ('.', '',

Php code for obtaining image width and height

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

PHP retrieves the list of dates specified by the current date

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_

Use PHP functions to calculate the length of Chinese and English strings

Example The code is as follows: Copy code Echo $ str = 'php point passthrough ';  Echo strlen ($ str); // 3*1 + 3*3 = 12Echo mb_strlen ($ str, 'gb2312'); // 3*1 + 3*2

Example of php getting utf8 string character length

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:

Php array merging and re-merging based on categories

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 an array to the file instance code

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.

Multiple random numbers in the range specified by php

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,

PHP Global variable definition usage

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

Create a desktop shortcut instance using PHP

 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

Php generates random color code instances

The code is as follows:Copy code Function randrgb (){  $ Str = '0123456789abcdef ';$ Estr = '#';$ Len = strlen ($ str );For ($ I = 1; $ I     {  $ Num = rand (0, $ len-1 );$ Estr = $ estr. $ str [$ num];    }  Return $ estr;} 

Total Pages: 12780 1 .... 9394 9395 9396 9397 9398 .... 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.