Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
$view->start(); $view->render("products", "list"); $view->finish();
以上是显示如何从文件渲染,我想知道是否可以使用此方法渲染字符串/代码?
$view->start(); $view->renderstring("<?php echo $this->url->get('users/list') ?>"); $view->finish();
您可以使用 'setContent' 来设置视图内容:
$view->setContent('<h1>hello</h1>');
但是这个函数接收视图的最终内容。所以做你给出正确用法的例子是:
$output = 'The link is: <a href="'.$this->url->get('users/list').'">link</a>'; $this->view->setContent( $output ); echo $this->view->getContent();