所以我试图浏览 Kohana 的第 3 版指南,但在 hello world 创建 View 部分不断收到错误。
ErrorException [ Warning ]: Attempt to assign property of non-object
Line 8: $this->template->message = 'hello world';
我将 site.php 放在 application/views 文件夹中...这是错误的位置吗...?
代码....
public $template = 'site';
public function action_index()
{
$this->template->message = 'hello world';
}
如果有人能阐明我做错了什么,我将非常感激......谢谢
最佳答案
糟糕,忘记扩展正确的 Controller 。
有
class Controller_Welcome extends Controller {
需要有
class Controller_Welcome extends Controller_Template {
关于php - Kohana 错误...尝试分配非对象的属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1736722/