## 模板賦值
傳入參數方法,我們采用助手函數的方法進行賦值,如下:
~~~
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);
}
}
~~~