模版赋值

方法定义

$this->template->assign(mixed $name [,mixed $value]);
// $name        
要在模板中赋值的变量名称,允许是字符串和数组;类型为数组时进行批量赋值,键名为变量名,键值为变量的值
// $value         
变量的值,当变量名为字符串时有效

使用举例

§   赋值一个字符串

$name = "cmstop";
$this->template->assign("name", $name);

§   赋值一个数组

$name = array("cmstop","admin");
$this->template->assign("name", $name);

§   批量赋值

$data = array(
            "name"=>"cmstop",
            "groupid"=>"1",
            "groupname"=>"
管理员"
);
$this->template->assign($data);



Copyright ©2009 - 2014 CmsTop.Com.All rights reserved.
思拓合众