2009-12-15 55 views
0

我遇到了通过引用修改smarty变量的问题。这里是我想要做的事:通过引用修改smarty对象

class foo { 
    $property; 
    public function getProperty(){ 
     return $this->$property; 
    } 
    public function index(&$smarty){ 
     $smarty->assign('test',$this->getProperty()); 
    } 
} 


$smarty = new Smarty(); 
$foo = new foo(); 
$foo->index($smarty); 

$smarty->display("test.tpl"); 

回答

0

其实NVM,我做的代码错误在其他地方。上面的代码是正确的:P