thinkphp3.2前台传递参数的获取方法

<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
   
    public function index(){
        $this->display();
    }

    public function login(){
   
    //1.传统方法获取值
    //echo $_GET['username'];
    //echo $_GET['password'];
   
    //2.i方法获取参数值
    //echo I('get.username');
    //echo i('get.password');

    //3.如果不存在djw变量,则值为0
    //echo I('get.djw',0);

    //echo "</br>";
    //4.对输入值进行过滤
    //echo I('get.username','htmlspecialchars');

    //5.直接获取整个get数组
    //var_dump (I('get.'));
   

    //6.用同样方法获取post、session、cookie中的变量
    //echo I('post.username');
   
    //7.自动判断提交方式获取变量值param
    //echo I('param.username');//可简化为echo I('username');
    //echo i('username');

    //8.变量转换为整型
    echo I('username/d');
    }

}

猜你喜欢

转载自djw0108043.iteye.com/blog/2395659