PHP file Upload class can generate thumbnail code

The code is as follows Copy Code if ($_get[' Action '] = = ' Save ' {                    $up = new Upload ();            $up->set_dir ( DirName (__file__). ' /upload/', ' {y}/{m} ');            $up->set_thumb (100,80) ;          

Mobile phone number in PHP regular expression code

Mobile (China Mobile phone number): The code is as follows Copy Code regexp= "^ ((d{3}) | ( d{3}-))? 13[456789]d{8}|15[89]d{8} " Verify if the phone number is a regular The code is as follows

Email with PHP

A script that sends an e-mail message may be one of the most common scripts you can find on a Web site, although it's simple, a mail script can sometimes make programmers very frustrated. There is a function called mail () in PHP that only needs to

PHP Part FAQ Summary One

PHP Part FAQ Summary-REPRINT 1: Why I can't get a variable I post data name to another page on one page, why can't I get any value when I output $name? Register_global defaults to off in later versions of PHP4.2 To obtain a variable

Php URL, date, IP, email address detection class Code

The code is as follows Copy Code Class validation{function Check_email ($value) {//check a email addressreturn (BOOL) Preg_match ('/^[a-z0-9._%+-]+@: [a-z0-9-]+.) +[a-z]{2,4}$/i ', $value);}function Check_ip ($value) {//check A IP

PHP is a regular judge can only enter alphabetic characters and digital examples

Digital Regular Filter The code is as follows Copy Code if (Preg_match ("/^\d*$/", $yebihai))Echo (' is a number ');ElseEcho (' not number ');or use a functionif (Is_numeric ($yebihai))Echo (' is a number ');ElseEcho ('

10 Tips for optimizing PHP program Laravel 5 Framework

Performance has always been a point of laravel framework, so tuning Laravel program is a must-learn skill. Next, share some of the best practices of development, as well as tuning techniques, and we have other suggestions and comments to discuss.

Encoding conversion between GB2312 and Unicode (UTF-8) using PHP

The following example converts gb2312 to a uft-8 formThe iconv function after php4.3.1 is very useful, but you only need to write a conversion function from uft8 to unicode.Check the table (gb2312.txt).$ Text = "e-book library ";Preg_match_all ("/[x8

Php domain name 301 redirection program code

Note:301,302 is an HTTP status code, indicating that a URL has been transferred. The difference is:301 redirect: 301 represents permanent transfer (Permanently Moved ),302 redirect: 302 indicates temporary transfer (Temporarily Moved ),ExampleIn php,

Php code for obtaining the current time in milliseconds

Php does not provide a function that returns the number of milliseconds, but provides a microtime () function that returns an array containing two elements, one being the number of seconds, one is the number of milliseconds represented by decimals.

Custom 404 status error page for header in php

Method 1 The code is as follows:Copy code @ Header ("http/1.1 404 not found ");@ Header ("status: 404 not found ");Echo 'echo 404 ';Exit (); Load a 404 error page The code is as follows:Copy code @ Header ("http/1.1 404 not found ");@

Php functions ob_start (), ob_end_clean (), ob_get_contents ()

Usage of the following three functionsOb_get_contents ()-return the content of the output bufferOb_get_contents(PHP 4, PHP 5)Ob_get_contents-return the content of the output bufferDescriptionString ob_get_contents (void)Only get the content of the

Definitions of variables and variables in PHP

Variables are used to store values, such as numbers, text strings, or arrays.Once a variable is set, we can reuse it in the script.All variables in PHP start with the $ symbol.The correct method for setting variables in PHP is:$ Var_name = value;

Rare worms targeting PHP vulnerabilities Linux security not in

According to foreign media reports, Linux and other open-source software are generally less likely to be attacked by viruses or hackers. However, a worm recently discovered has aroused the attention of the open source community. This virus is

Convert a php image to an ascii output image

Function image2ascii ($ image){ // Return value$ Ret = '';// Open the image$ Img = ImageCreateFromJpeg ($ image );// Get width and height$ Width = imagesx ($ img );$ Height = imagesy ($ img );// Loop for heightFor ($ h = 0; $ h     { // Loop for

Solve the 502 Bad gateway problem caused by the false death of php-cgi

If the php-cgi process is insufficient, the php execution time is long, or the php-cgi process is dead, a 502 error will occur.1). Long php execution timeIf the server performance is good enough and the bandwidth resources are sufficient, you can

Php file Upload instance (with file type restrictions)

Today, I improved my file Upload systems for several other websites.Php code, no js, file type determined by suffix name, non-mime judgment.Create up. php with the following code: The code is as follows:Copy code $ Uptype = array ("jar", "zip ");

How does php obtain the array key name instance code?

My php foreach () function can traverse the array and retrieve the key value of the array. How can I get the key name $ key? Or just take the first key name? For example The code is as follows:Copy code $ Keyarray = array ('000000' =>

Php Exception print error trace instance

For php exceptions, you can get the error stack through getTraceAsString.The error should be as follows: The code is as follows:Copy code Function x ()$ X = debug_backtrace ();// Remove stack of this functionArray_shift ($ x );$ I = 0;$ Xstr = ''

Differences and connections between session and cookie in php

First, let's talk about cookies. Baidu Encyclopedia defines the data (usually encrypted) that a website stores on a local user terminal to identify users and track sessions ).The method for generating a cookie in php is simple: setcookie (name,

Total Pages: 12780 1 .... 1468 1469 1470 1471 1472 .... 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.