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.
控制器:
controllers |-FooController.php |-BarController.php
观点:
view |-foo| | |-index.php | |-error.php | |-bar| |-index.php
如何使用栏控制器的操作呈现 error.php 视图?我努力了:
$this->render('foo/error');
但它不起作用。
尝试这个
$this->render('//foo/error');
如果你不回显它,你会得到一个空白页。正确的方法是
<?= $this->render('//foo/error'); ?>
或者
<?php echo $this->render('//foo/error'); ?>
这也适用于 Yii2