PHP class-experiment 4

Source: Internet
Author: User
PHP class-experiment 4PHP class-experiment 4 & nbsp; objective: to master the basic application of functions in PHP, pay attention to the passing of parameters & #20540; the difference between passing references and understanding the basic applications of forms in PHP, including get and post methods. Note the difference between the two methods to understand how to open files in PHP, close and upload the cookies and ses PHP class in PHP-experiment 4
PHP class-experiment 4

 

 

Purpose:

Measure the test taker's knowledge about the basic applications of functions in PHP. pay attention to the differences between passing values and transferring references during parameter transfer.

Understand the basic applications of forms in PHP, including get and post methods. note the differences between the two methods.

Understanding how to open, close, and upload files in PHP

Understanding the basic usage of cookies and sessions in PHP

 

Lab content:

1. compile a php dynamic page, embed a piece of php code in the html tag, and assign a text value to the variable $ x; then, the value of $ x is used as the value attribute value of the text input box in an html form.

Tip:

Usage:

 

2. use form for dynamic interaction between different pages (the difference between get and post ,)

Create two pages, and use the form and sumbit buttons: submit the values in the input box of the previous page to the next page for display.

Tip:

1) previous page:

Page jump:Exam4_2_post.php "; Echo $ _ POST [" username "];?>


3. source code:

Exam4_3.php

Sort the order of input numbers
 The sorting result is:
"; While (list ($ key, $ v) = each ($ x) {echo" $ key $ v
";}}?>


4. source code:

Exam4_4.php

File UploadUpload_file.php
 0) {echo "return code:". $ _ FILES ["file"] ["error"]."
";} Else {echo" upload: ". $ _ FILES [" file "] [" name "]."
"; Echo" type: ". $ _ FILES [" file "] [" type "]."
& Quot; echo & quot; size: & quot;. ($ _ FILES [& quot; file & quot;] [& quot; size & quot;]/1024). & quot; kb
"; Echo" temporary file ". $ _ FILES [" file "] [" tmp_name "]."
"; If (file_exists (" d :/". $ _ FILES ["file"] ["name"]) {echo $ _ FILES ["file"] ["name"]. "already exists. ";} else {move_uploaded_file ($ _ FILES [" file "] [" tmp_name "]," d :/". $ _ FILES ["file"] ["name"]); echo "saved in :". "d :/". $ _ FILES ["file"] ["name"] ;}}?>






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.