时间:2021-07-01 10:21:17 帮助过:21人阅读
//模块
public function login($userName,$passWord,$validCode) {
$param['userName'] = $userName;
$param['passWord'] = $passWord;
$param['validCode'] = $validCode;
return $param;
}
//控制器
public function test(){
$userName = $_POST['userName'];
$passWord= $_POST['passWord'];
$validCode= $_POST['validCode'];
$this->login($userName,$passWord,$validCode));
}
//模块
public function login() {
$param['userName'] = $_POST('userName');
$param['passWord'] = $_POST('passWord');
$param['validCode'] = $_POST('validCode');
return $param;
}
//控制器
public function test(){
$this->login();
}
可是现在大多数人都是用的第一种写法!我的写法我承认在命令行运行的时候可能会有问题!但我觉得为了代码的简洁我会选择封装一个函数来让我的写法适应各种场景