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 Chinese character verification code generation program

Class simpleimage {Var $ image;Var $ image_type;Function load ($ filename ){$ Image_info = getimagesize ($ filename );$ This-> image_type = $ image_info [2];If ($ this-> image_type = imagetype_jpeg ){$ This-> image = imagecreatefromjpeg ($ filename )

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

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_

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:

Use php to read text files and replace specified rows

The code is as follows:Copy code $ File_path = '123.txt ';$ Content = file_get_contents ($ file_path );// Separate all content into an array by linefeed$ Con_array = explode ("n", $ content );// Replace the specified row     $ Con_array [12] = "12

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 batch delete excessive links in webpage content

Let's briefly describe the principle. Here we reuse the PHP replacement function preg_replace. In practice, we often use preg_replace to replace some dangerous characters or convert some slashes or carriage returns. Preg_replace ($1, $2, $3) has

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 code for getting a random array list

Paste a piece of code. You don't need to say much about getting random arrays in php. Directly paste the code. The array_rand in php is abnormal. It breaks through normal people's understanding and is tedious.Example 1 The code is as follows:Copy

PHP regular expression to determine whether the input is a letter instance program

Code on The code is as follows:Copy code Header ('content-type: text/html; charset = utf-8 ');$ Str = "dasdadsfsadASDSADS ";If (preg_match ('/^ [a-zA-Z] + $/', $ str )){Echo $ str. "is a letter ";}Else{Echo $ str. "not a letter ";}?> This is

PHP session details

SummarySession refers to the time that a user spends browsing a website from entering the website to closing the browser. From the above definition, we can see that Session is actually a specific concept of time.Generally, variables (server-side

PHP: where is the road?

PHP4: behind the miracleIn 1995, Rasmus was using PHP to write his personal homepage. Today, PHP has become a popular scripting language around the world, and more sites choose to use PHP, even Yahoo gave up its own script and switched to PHP to

Example of adding a watermark to a php image

/*** Adding watermarks to images* $ Target source file path* $ Wtrmrk_file watermark image path* $ Newcopy watermark image path     * */Public function watermark_image ($ target, $ wtrmrk_file, $ newcopy ){$ Watermark = imagecreatefrompng ($

Use the string truncation function in php to delete a string from the end.

Fixed a bug in obtaining the controller name.The controller names end with act and delete act when using it.1. Original method// Use the act replacement method to obtain the controller name. Obviously, when the controller name contains three

Php determines whether the website is accessed by android, ios, or wp.

In php, you can use $ _ SERVER ['http _ USER_AGENT '] to distinguish between android, ios, and wp Requests. You can use the following code to implement this function:$ UserAgent = $ _ SERVER ['http _ USER_AGENT '];If (preg_match ("/(iPod | iPad |

Total Pages: 12780 1 .... 10625 10626 10627 10628 10629 .... 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.