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
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
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"
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
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 ($
_ 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
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 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
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 =
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.
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
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
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
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
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
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 ()
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