PHP reads the contents of the file and outputs the display

Example The code is as follows Copy Code ?$file _name= "1.txt";echo $file _name. "";$FP =fopen ($file _name, ' R ');$buffer =fgets ($FP);while (!feof ($fp)) {$buffer =fgets ($FP);Echo $buffer;}Fclose ($FP);?>

$a++ and + + $a notes for self-adding operation in PHP

Here we talk about the PHP operation symbol of the upgrade version: ++,--, hehe. + + is the self increase, -that is, self reduction. Practical application: $a = 10;  $a + + =? First use the Plus, the final result is 11. $a = 10;  + + $a =?

PHP in_array () Function usage considerations

0.in_array commonly used methods of use The code is as follows Copy Code $nameslist = Array ("Small skin", "small Xuan Xuan", "works to", "cute little Trade");if ("In_array", $nameslist)){echo "Find it";}Else{echo "Do

Ajax and PHP Basics Tutorials

。 The following is an example for updating statistics: $ (' #stats '). Load (' stats.html ');This code, as if it were only executed once, I now want to implement real-time data updates, such as statistics online number $.post ('

Php str_replace input box, press enter to replace br

The code is as follows:Copy code Function htmtocode ($ content ){$ Content = str_replace ("n", "", str_replace ("", "", $ content ));Return $ content;} Replace spaces and press enter.Equivalent: The code is as follows:Copy code Function

Php functions call_user_func and call_user_func_array

Php Tutorial functions call_user_func and call_user_func_arrayThe call_user_func function is similar to a special method for calling a function. The usage is as follows:Function a ($ B, $ c){Echo $ B;Echo $ c;}Call_user_func ('a, "111", "222 ");Call_

PHP mysql_field_type () function

Definition and usageMysql tutorial _ field_type() Specifies the field type in the returned result set of the function.If the operation succeeds, the type of the specified field is returned. If the operation fails, false is returned.SyntaxDescription

Php substr (), explode (), strrev ()

Substr (str, start, length );Example: substr ('php tutorial is very good language );Output is ve;If the length of start> str is returned ();Substr ('php is very good language );Substr ('php is very good language ', 4 );Output as (blank)Output is v

Php _ call _ autoload _ clone _ toString _ sleep

_ Wakeup1. _ call_ Call ($ method, $ arg_array) when an undefined method is calledA special method _ call () is added to the object in php Tutorial 5, which is used to monitor otherMethod. If you try to call a method that does not exist in an object,

Php perfect ereg authentication file Upload

Ereg (regular expression, string, [matching partial array names]);For more details, see: php Tutorial er/18/2 a94e504e94424a7a461342d049c0018.htm "> http://www.111cn.net/phper/18/2a94e504e94424a7a461342d049c0018.htmThis program uses ereg to verify

E-mail address in the php regular string

If you are the first to verify the mailbox, if you want to obtain the article or string to check whether there is a mailbox address, you can use the second one.*/Function funcemail ($ str) // email regular expression{Return (preg_match ('/^ [_. 0-9a-

Php obtains the number regular expression in the string.

The filter_sanitize_number_int filter deletes all invalid characters in the number.This filter allows all numbers and + -.*/$ Number = "5-2 + 3 pp ";Var_dump (filter_var ($ number, filter_sanitize_number_int ));/*Verification Number: ^ [0-9] *

Php extension_loaded determines whether the GD extension Library is loaded

If (! Extension_loaded ('gd ')){// If not loaded, perform the load operationIf (! Dl ('gd. So '))  {// If loading fails, all operations are terminated.Echo "gd library loading failed ";Exit;  }}

Php image processing functions get type extensions

Image_type = image_type_to_mime_type (imagetype_png); // Obtain the mime type of pngEcho $ image_type; // output result//$ File = '1.jpg ';$ Image = imagecreatefromjpeg ($ file );Header ('content-type: '. image_type_to_mime_type (imagetype_wbmp ));$

Usage of the ftp_chdir () ftp_cdup () function in php

If yes, true is returned. Otherwise, false is returned. If the directory fails to be switched, the php Tutorial will also issue a warning.SyntaxFtp_chdir (ftp_connection, directory) parameter descriptionFtp_connection is required. Specifies the ftp

Common socket instances in php

Code Extension to obtain remote host socket information */Function getpeername (){$ Remote_ip = $ remote_port = 0; // defines the ip address.Socket_getpeername ($ this-> fd, $ remote_ip, $ remote_port); // return host informationReturn array ($

Common string processing functions in php

Definition and usageThe chop () function removes white spaces or other predefined characters from the end of a string.The alias of the rtrim () function of the function.SyntaxChop (string, charlist)*/$ Str = "I'm a teacher"; // define a string$

Php header function implementation code

Definition and usageThe header () function sends the original http header to the client.It is important to realize that the header () function must be called before any actual output is sent (in php 4 and later versions, you can use the output cache

Php checks the sizeof count function of array length

The function used to check the length of the array in php is sizeof count. Check a simple instance */$ Colorlist = array ("apple" => "red", "grass" => "green", "sky" => "blue ", "night" => "black", "wall" => "white ");Echo "array length:". count ($

Php deletes folders and all files under them.

The code is as follows:Copy code // Delete the folder and all its filesFunction deldir ($ dir ){$ Dh = opendir ($ dir );  While ($ file = readdir ($ dh )){  If ($ file! = "." & $ File! = ".."){    $ Fullpath = $ dir. "/". $ file;    If (! Is_dir (

Total Pages: 12780 1 .... 12243 12244 12245 12246 12247 .... 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.