輸出
echo- echo '<a href=""></a>';
- echo 變數名稱;
複製代碼 print- print("hello");
- print(變數名稱);
複製代碼 輸入
$_GET 獲取URL中,'?'之後的值
範例: example.com/index.php?name=John&age=25- $name = $_GET['name'];
- $age = $_GET['age'];
複製代碼 $_POST 從表單提交中獲取訊息- <form method="post" action="process.php">
- <input type="text" name="username">
- <input type="password" name="password">
- <input type="submit" value="Login">
- </form>
複製代碼- $username = $_POST['username'];
- $password = $_POST['password'];
複製代碼 $_REQUEST 可從各方向獲取資料,包含get、post、cookie等- $name = $_REQUEST['name'];
複製代碼 |