简体   繁体   English

在kohana中找不到请求的视图1.php

[英]The requested view 1.php could not be found in kohana

I'm trying to learn the framework kohana. 我正在尝试学习框架kohana。 I have defined a new controller under application/controller/classes. 我在应用程序/控制器/类下定义了一个新的控制器。 Which I named to hello.php: 我将其命名为hello.php:

class Controller_Hello extends Controller
{

public function action_say(){
    $g = new View('firstv');
    $g->render(TRUE);

}

}
?>

And I have this under application/views. 我在应用程序/视图下有这个。 Which I called firstv.php: 我将其称为firstv.php:

<h1>testing1</h1>

What's the mistake here. 这是怎么了 I'm using this guide: http://pixelpeter.com/kohana/kohana101.pdf 我正在使用此指南: http : //pixelpeter.com/kohana/kohana101.pdf

I'm using the latest stable version 3.1.3.1. 我正在使用最新的稳定版本3.1.3.1。 I have called the function by navigating to: http://localhost/kohana/index.php/hello/say 我通过导航到以下位置来调用该函数: http://localhost/kohana/index.php/hello/say

Tried this using the same say function. 尝试使用相同的say函数。 And it worked. 而且有效。 But this one doesn't use views. 但这不使用视图。

$this->response->body('hello, world 2!');

Please help, thanks. 请帮忙,谢谢。

$this->response->body($g->render());

So your complete action method will be something like: 因此,您完整的操作方法将类似于:

public function action_say()
{
    $g = new View('firstv');
    $this->response->body($g->render());
}

or: 要么:

public function action_say()
{
    $g = new View('firstv');
    $this->response->body($g);
}

or even: 甚至:

public function action_say()
{
    $this->response->body(new View('firstv'));
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM