具体如下:
控制器中变量
public function register() {
$type = I("param.type");//1.学生注册 2.教师注册 3.其他注册
$this -> assign("type", $type);
//q全部部门
$depart1 = M("Depart") -> where("status=1 and fid=0") -> order("id asc") -> select();
$this -> assign("depart1", $depart1);
$this -> display();
}模板中引用位置一:php代码中,直接用$i;
echo $i; 模板中引用位置二:模板中直接应用
{$i}或者class="{$unlogined}"注意:1.非相关人员,严禁注册。{$i}
$logined = is_array($_SESSION['userInfo']) ? "" : "hide-div"; $unlogined = $logined == "hide-div" ? "" : "hide-div"; 模板中引用位置三:模板标签中用,如condition中用,不加{}。
相关内容