• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • Yaf_View_Simple::clear()

    (Yaf >=2.2.0)

    Clear Assigned values

    说明

    publicYaf_View_Simple::clear([string $name]): bool

    清除指定的变量

    参数

    $name

    分派的变量名

    如果为空,将会清除所有的变量

    返回值

    范例

    Example #1 Yaf_View_Simple::clear()example

    <?php
    class IndexController extends Yaf_Controller_Abstract {
        public function indexAction() {
            $this->getView() >clear("foo")->clear("bar"); // clear "foo" and "bar"
            $this->_view->clear(); //clear all assigned variables
        }
    ?>
    

    参见

    • Yaf_View_Simple::assignRef() The assignRef purpose
    • Yaf_View_Interface::assign() 为视图引擎分配一个模板变量
    • Yaf_View_Simple::__set() 为视图引擎分配一个模板变量