Get Smarty

Donate

Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Advertisement

Name

getRegisteredObject() — 获取已注册对象

说明

array getRegisteredObject(string object_name);

该函数可以很方便地在自定义函数中获取一个注册对象。详情参见 对象

Example 14.28. getRegisteredObject()


<?php
function smarty_block_foo($params, $smarty)
{
  if (isset($params['object'])) {
    // 获取已注册对象
    $obj_ref = $smarty->getRegisteredObject($params['object']);
    // 现在可通过 $obj_ref 来操作对象
  }
}
?>

   

参见 registerObject(), unregisterObject()对象

Comments
No comments for this page.

Advertisement