相当于什么
警予::应用程序() - >控制器 - >的RenderPartial
在Yii2 ??
use*_*826 12
在视图文件中,$this引用yii\web\View对象只需调用:
$this->render('partials/_profile', ['name'=>'value']);
Run Code Online (Sandbox Code Playgroud)
它会起作用.
或传递和绝对路径renderFile()跳过调用findViewfile():
$this->renderFile(dirname(_FILE__) . '/partials/_profile.php', ['name'=>'value']);
Run Code Online (Sandbox Code Playgroud)
Mah*_*dın 11
在yii2
Yii::$app->controller->renderPartial('myview');
Run Code Online (Sandbox Code Playgroud)
小智 0
Yii2 与 Yii1 不同,使用命名空间。因此,要调用 renderPartial() 函数,您需要先调用“yii\base\Controller”命名空间,然后使用 renderPartial() 函数。