assign() public method

模板变量赋值
public assign ( mixed $name, mixed $value = '' ) : void
$name mixed
$value mixed
return void
Ejemplo n.º 1
0
 public function testVarGet()
 {
     $template = new Template();
     $data = ['a' => 'a', 'b' => 'b'];
     $template->assign($data);
     $this->assertEquals($data, $template->get());
 }
Ejemplo n.º 2
0
 public function testVarAssign()
 {
     $template = new Template();
     $template->assign('name', 'value');
     $value = $template->get('name');
     $this->assertEquals('value', $value);
 }