PHP Delete File unlink

You know how to build a file. You know how to open a file in a variety of different ways. You don't even know how to read and write data from a file!Now is the time to learn how to destroy (delete) files. Files deleted in PHP are interrupted by

PHP SQL query Record Select

Connecting to a database$link _id = mysql_connect ("localhost", "root", "") or Die ("Connection failed");if ($link _id){Select Databasemysql_select_db ("My_test");The above is the header database Connection section, which is the following common

PHP inserts data, insert Save record

if ($_post[ok]){$link _id = mysql_connect ("localhost", "root", "") or Die ("Connection failed");if ($link _id){Select Databasemysql_select_db ("My_test");Insert Data SQL statement$sql = "INSERT into userinfo values ('. $_post[id]." ', ' ".

Php logon and logout instance code

Login.htm The code is as follows:Copy code Untitled Document Login. php The code is as follows:Copy code Function showPage () // determine whether to log on without logon. Directly jump to the logon page.{If (! Isset ($ _ SESSION ["user"

Php message board creation tutorial

Create a data table The code is as follows:Copy code Create table 'message '('Id' tinyint (1) not null auto_increment,'User' varchar (25) not null,'Title' varchar (50) not null,'Content' tinytext not null,'Lastdate' date not null,Primary key

Php deletes non-empty directory program code

It's a very simple php Tutorial, and it's also an entry-level thing, so I won't talk much about it.Code The code is as follows:Copy code // Description: Solution for deleting non-empty directoriesFunction removeDir ($ dirName){ If (! Is_dir ($

Cookie usage in php

 Write cookie The code is as follows:Copy code Setcookie (name, value, expire, path, domain );Function w_cookie ($ n, $ c, $ e = 0, $ isdes = 1) {If ($ isdes = 1) {$ c = endes ($ c, Region EY );}$ Exp = time () + 3600*24*30;If ($ e = 0)    

PHP _ METHOD _ magic constant usage

_ METHOD _ is a new magic constant after PHP5, indicating the name of the quasi-grammar. The code is as follows:Copy code Class chhua {Function test (){Echo _ METHOD __; }} $ E = new chhua (); $ E-> test (); // output: chhua: test There are

In PHP, array_merge merges two arrays.

The code is as follows:Copy code  Echo "rn First case rn ";$ A = array (1, 2, 3, 4, 5, 6 );$ B = array (7,8, 9 );  $ C = array_merge ($ a, $ B );Print_r ($ c );$ C = $ a + $ B;Print_r ($ c );$ C = $ B + $;Print_r ($ c );    Echo "rn second case

Modify the default PHP session time

Modify the three rows as follows:1. session. use_cookiesSet this value to 1 and use cookie to pass sessionid2. session. cookie_lifetimeThis indicates the time when SessionID is stored in the client Cookie. The default value is 0, indicating that the

Php ob_start () implements the variable program for storing images

The code is as follows:Copy code $ ImgPath = "Image address ";// Obtain image information $ imgPath can be a remote addressList ($ srcWidth, $ srcHeight, $ type) = getimagesize ($ imgPath );...Switch ($ type ){Case 1: $ imgCreate =

PHP array_merge merge and split two arrays

The code is as follows:Copy code $ Arr1 = array ("a", "B", "c ");$ Arr2 = array ("c", "d", "e ");$ Myarray = array_merge ($ arr1, $ arr2 );Print_r ($ myarray );$ Myarray = array_unique ($ myarray );Print_r ($ myarray );?> Example The code is as

Php display_errors and log_errors

Display_errorsError Echo, which is commonly used in development mode. However, many applications forget to disable this option in the formal environment. Error Echo can expose a large amount of sensitive information to facilitate the next attack.

Summary of the impact of php's safe_mode mode on functions

Function name restrictionsDbmopen () checks whether the operated file or directory has the same UID (owner) as the script being executed ).Dbase_open () check whether the operated file or directory has the same UID (owner) as the script being

Php file_get_contents () read and collect remote file content

The file_get_contents () function is the preferred method for reading the file content into a string.In The Help Manual above, all the content is read into the memory at a time, and we will also discuss the following examples._ Get_contents can read

Php automatically recognizes echo or dump based on the variable type

The code is as follows:Copy code Function show_var ($ var ){If (is_scalar ($ var )){Echo $ var;} Else {Var_dump ($ var );} } $ Pi = 3.1416;$ Proteins = array ("hemoglobin", "cytochrome c oxidase", "ferredoxin ");Show_var ($ pi );// Print

Php array loop output implementation method

In PHP, we can use the following loop statement:WhileThe code block is executed cyclically as long as the specified condition is true.Do... whileExecute a code block first, and then repeat the loop when the specified condition is set.ForNumber of

Learning notes for some php arrays

The code is as follows:Copy code Header ('content-Type: text/html; charset = utf-8 ');Echo ' ';Function var_array ($ array){ Echo ' ';Var_dump ($ array );Echo ' ';} Function printr ($ array){ Echo ' ';Print_r ($ array );Echo ' ';} Function getArr

Php function variable scope and function return value tutorial

See the instance below The code is as follows:Copy code $ A = 1;$ B = 2;Function Sum (){Global $ a, $ B;$ B = $ a + $ B;}Sum ();Echo $ B;?> In this way, the value of $ B is 3, and global is a global variable in php. So let's look at the php

Php strtotime function and instance tutorial

This function uses the TZ environment variable (if any) to calculate the timestamp. PHP 5.1.0 has an easier way to determine the time zone of All/dateTime functions used. This process is explained on the page of the date_default_timezone_get ()

Total Pages: 12780 1 .... 5663 5664 5665 5666 5667 .... 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.