Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTTP 1.1 Method OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT

Similar presentations


Presentation on theme: "HTTP 1.1 Method OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT"— Presentation transcript:

1

2 HTTP 1.1 Method OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT

3 GET 被傳送資料以Query String*加在URL後 有長度限制 較POST快
*一種Key/Vaule的編碼方式,從問號「?」開始,每一組值都是用「&」隔開

4 get. html <form action="get. php" method="get"> Enter your name
get.html <form action="get.php" method="get"> Enter your name.<br> <input type="text" name="name" /> <input type="submit" value="Enter" /> </form> get.php <?php echo "Hello, ".$_GET['name']."!"; ?>

5 POST 被傳送資料隱藏在message-body中 可傳送大量資料 較GET安全

6 post. html <form action="post
post.html <form action="post.php" method="post"> Enter your name.<br> <input type="text" name="name" /> <input type="submit" value="Enter" /> </form> post.php <?php echo $_POST['name']; ?>

7 一旦有人截取你的封包,你的資訊還是會被看光光,而且他還能竄改你的封包內容

8 頁面轉跳 post00.html <form action="post00.php" method="post"> post00.php <?php echo $_POST['name']; header("Location:post.html"); exit; //確保後續程式碼不會被執行 ?>

9 Session 將資料存在伺服器端 即使在其他頁面也能存取資料 啟動session、消除所有變數、銷毀連線 session_start();
session_unset(); session_destroy();

10 session01. php <. php session_start(); //一定要先啟動session才能使用
session01.php <?php session_start(); //一定要先啟動session才能使用! $_SESSION['a']=1; $_SESSION['b']=2; echo "a = ".$_SESSION['a']; ?> session02.php <?php session_start(); echo "b = ".$_SESSION['b']; ?>


Download ppt "HTTP 1.1 Method OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT"

Similar presentations


Ads by Google