标签:runtime com img blog pat control input erp 分享
在项目根目录输入命令: php composer.phar require --prefer-dist yiisoft/yii2-smarty
如果报错 Could not open input file: composer.phar 则重新输入命令:omposer require --prefer-dist yiisoft/yii2-smarty
config下web.php的components里进行配置:
‘view‘ => [
‘renderers‘ => [
‘tpl‘ => [
‘class‘ => ‘yii/smarty/ViewRenderer‘,
//‘cachePath‘ => ‘@runtime/Smarty/cache‘,
],
],
],
控制器 controller.php:
public function actionIndex(){
return $this->renderPartial(‘index‘, [‘text‘ => ‘ world!‘]);
}
模板 index.php:
hello{$text}
会输出:hello world!
标签:runtime com img blog pat control input erp 分享
原文地址:http://www.cnblogs.com/facetwitter/p/5999868.html