PHP implementation character Fu Jing URL implementation code

English: The code is as follows Copy Code function Tourl ($STR) {$str = preg_replace ('/[^a-za-z0-9]+/', '-', $str);$str = Trim ($str, '-');Return Strtolower ($STR);} Contains special characters:

Conversion of Chinese Pinyin to Php

$d =array ( Array ("A",-20319), Array ("AI",-20317), Array ("an",-20304), Array ("Ang",-20295), Array ("AO",-20292), Array ("BA",-20283), Array ("Bai",-20265), Array ("Ban",-20257), Array ("Bang",-20242), Array ("Bao",-20230), Array

The taste of the PHP frame

Author: Lao Wang At present, the most successful framework in the PHP community is cakephp,symfony,zendframework, the choice is always good, but the choice is also a worry, is the so-called "two watch people never know the exact time." Today is

PHP generates a simple example of a static page

A simple example:News template file news_tmp.html:{title}{news_title}{news_image} {news_content}______________________________________________________________________________________________Answer 7:News Generation file aaa.php:?Let's say the

PHP to add gray transparency to the picture

Principle: 1. First calculate the size of the original picture2. Create translucent pictures of the same size3. Use the Imagecopy () method to merge the newly created translucent pictures with the original artwork The code is as follows

How PHP Gets the detailed data for the size of the flash

If you also want to get the size information of the Flash file by parsing the SWF file header information, that's a bit far away. Since PHP 4 has been built into the getimagesize function to do this. Its function determines the size of any

PHP header () output picture cache

In many development, we try to use header ("Content-type:image/jpeg") to output pictures, try to use some PHP image processing technology, make the output picture more intelligent and dynamic. But we often encounter new problems, unless you specify

Php generates ip addresses on images

The code is as follows:Copy code $ Img = imagecreate (180,50 );$ Ip = $ _ server ['remote _ addr '];Imagecolortransparent ($ img, $ bgcolor );$ Bgcolor = imagecolorallocate ($ img, 0x2c, 0x6d, 0xaf); // background color$ Shadow =

Php scaling down images

The code is as follows:Copy code Function imageresize2 ($ width, $ height, $ targetw, $ targeth){$ Percentage = 1;If ($ width> $ targetw) | ($ height> $ targeth ))  {$ Width_diff = $ width-$ targetw;$ Height_diff = $ height-$ targeth; If ($ width_

Php verification code program

The code is as follows:Copy code Session_start ();$ Im = imagecreatetruecolor (100,30 );// Assign color$ Bg = imagecolorallocate ($ im, 0, 0 );$ Textcolor = imagecolorallocate ($ im, 255,255,255 );// Mark the imageFor ($ I = 0; $ I $ Te1 =

Php image operations (1/3)

The code is as follows:Copy code Class image {Public $ filename;Private $ info;Private $ im;  // ConstructPublic function _ construct ($ filename ){$ This-> filename = $ filename;$ This-> info = @ getimagesize ($ filename );If ($ this-> info [2]>

Php code for adding a text watermark and an image watermark to an image (1/2)

$ Image-> wprint_img (); // executes the image watermark.$ Image-> wprint_string (); // execute a text watermark*/ The code is as follows:Copy code Class editimage {Private $ imagefile; // image filePrivate $ smallimg; // watermark imagePrivate $

Php bar chart generation class code

The code is as follows:Copy code Function createimage ($ data, $ twidth, $ tspace, $ height ){$ Dataname = array ();$ Datavalue = array ();$ I = 0;$ J = 0;$ K = 0;$ Num = sizeof ($ data );                        Foreach ($ data as $ key => $ val )

Php watermarks images in batches

// Config. php// ================================================= User configuration area ==== ====================================$ Per = 1; // Number of images processed each time$ Dir1 = 'IMG '; // enter the Directory$ Dir2 = 'img2'; // the

Php image upload code (with the ability to generate thumbnails and add watermarks)

  The code is as follows:Copy code Class upfile {Public $ filepath = "www.111cn.net/"; // upload a file storage folderPublic $ filesize = 1000000; // size of the file to be uploaded// If you want to modify the file type that can be uploaded,

Strictly control the instance for session timeout in php

First answerThe most common answer is: Set the Session expiration time, that is, session. gc_maxlifetime. This answer is incorrect for the following reasons:1. first, PHP runs the session gc with a certain probability, that is, the session.

Parameter usage of json_decode and var_export in php

Both json_decode and var_export have the second parameter. I have never noticed it before. T_T. Besides, this var_export function is also the first time I know about it. The basics are still not solid.Json_decode(PHP 5> = 5.2.0, PECL json: 1.2.0-1.2.

Description of the Chinese truncation function mb_substr () in php

1. Chinese interception: mb_substr ()Mb_substr ($ str, $ start, $ length, $ encoding)$ Str: string to be truncated$ Start: truncates the start point. The start point is 0.$ Length, number of words to be intercepted$ Encoding: webpage encoding, such

Php Cache design

$ Cahetime = 2; // Set the Expiration Time$ Cahefile = "cahe.txt"; // read/write textIf (file_exists ($ cahefile) & time ()-$ cahetime  Echo file_get_contents ($ cahefile ); }Else {File_put_contents ($ cahefile, date ("y-m-d H: I: s", time ())); }?>

Php date difference 8 small time solution

The initialization statement for adding time to the program: "date_default_timezone_set (" asia/shanghai ");Definition and usageThe date_default_timezone_set () function sets the default timezone used by all date/time functions.The

Total Pages: 12780 1 .... 10641 10642 10643 10644 10645 .... 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.