$_GET 与 $_POST 的区别

一般情况下:

1、$_POST用于表单之中,而$_GET用于超链接之中。

2、$_POST对数据来说比较安全,而$_GET就略显不足。


代码如下:

 $_POST  用法:
<form method="post" action="text17.php">	 姓 名:<input type="text" name="username"/><br/>  					密 码:<input type="password" name="password"/>						  验证码:<input type="text" name="code" size="5"/>1234<br/>				  内 容:<textarea rows="6" cols="25" name="content"></textarea><br/>      		  <input type="submit" value="提交" name="send">					</form>               
<?php
if (!isset($_POST['username']))
    {
        header('location:text17.php');
        exit;
    }
    else
    {
        $username = $_POST['username'];
        $password = $_POST['password'];
        $code     = $_POST['code'];
        $content  = $_POST['content'];
        echo '用户名:'.$username.'<br/>';
        echo '密  码:'. $password.'<br/>';
        echo '验证码:'.$code.'<br/>';
        echo '介  绍:'.$content.'<br/>';
    }
    if (strlen($username) <= 2)
    {header('location:text17.php');
        exit;

    }
$_GET   用法:
<a href="text19.php?a=5">huangjinao </a>
<?php
    echo $_GET['a'];

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值