## 模板赋值
传入参数方法,我们采用助手函数的方法进行赋值,如下:
~~~
namespace app\modules\home;
use mysql\db as DB;
class check extends base{
public function index(){
//查询客户表中所有的会员卡号
$all=DB::w()->table('customers')->all();
foreach ($all as $k => $v) {
$indu[$v->id]=$v->number;
}
$data['indust'] = array_filter($indu);
//dump($data['indust']);exit;
$data['id']=$_GET['id'];
$did = model('customers')->one(['id'=>$data['id']]);// 根据get到id 查询 用户表
$data['img']=$did->img;
$data['dd'] = $did->niname;// 查询用户昵称
$data['user'] = $did->nickname;// 查询用户姓名
$data['sex'] = $did->sex;//查询用户性别
$data['number'] = $did->number;//查询用户vip卡号
$data['tel'] = $did->tel;//查询用户手机号码
$data['customers_cost_id'] = $_GET['customers_cost_id'];
return view('check',$data);
}
}
~~~