本文整理匯總了PHP中Phalcon\Mvc\View::reset方法的典型用法代碼示例。如果您正苦於以下問題:PHP View::reset方法的具體用法?PHP View::reset怎麽用?PHP View::reset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Phalcon\Mvc\View
的用法示例。
在下文中一共展示了View::reset方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testViewOptions
public function testViewOptions()
{
$config = array('cache' => array('service' => 'otherCache'));
$date = date("r");
$content = '<html>' . $date . '</html>' . PHP_EOL;
$di = $this->_getDi('otherCache');
$view = new View($config);
$view->setDI($di);
$view->setViewsDir('unit-tests/views/');
$view->setVar("date", $date);
$view->start();
$view->cache(true);
$view->render('test8', 'other');
$view->finish();
$this->assertEquals($view->getContent(), $content);
$view->reset();
sleep(1);
$view->setVar("date", date("r"));
$view->start();
$view->cache(true);
$view->render('test8', 'other');
$view->finish();
$this->assertEquals($view->getContent(), $content);
}
示例2: testViewOptions
public function testViewOptions()
{
$this->specify("Views are not cached properly when passing options to the constructor", function () {
$this->_clearCache();
$config = array('cache' => array('service' => 'otherCache'));
$date = date("r");
$content = '<html>' . $date . '</html>' . PHP_EOL;
$di = $this->_getDi('otherCache');
$view = new View($config);
$view->setDI($di);
$view->setViewsDir(PATH_DATA . 'views' . DIRECTORY_SEPARATOR);
$view->setVar("date", $date);
$view->start();
$view->cache(true);
$view->render('test8', 'other');
$view->finish();
expect($view->getContent())->equals($content);
$view->reset();
sleep(1);
$view->setVar("date", date("r"));
$view->start();
$view->cache(true);
$view->render('test8', 'other');
$view->finish();
expect($view->getContent())->equals($content);
});
}