Home >Backend Development >PHP Tutorial >php kohana framework view usage
// controller directory extends.php
class Controller_Extends extends Controller{
Public function action_whj(){
$state = "whjsjq";
$expression = false;
$view = View::factory(' application/whj');//Calling the view template file
$view->state = $state;//Assigning the view variable
$view->expression = $expression;//Assigning the view variable
$this-> response->body($view);
}
}
?>
//whj.php in the view/application directory
This will show if the expression is true.
Otherwise this will show.
Call https://192.168 .0.170/ad/extends/whj
Result:
Otherwise this will show.whjsjq
The above introduces the use of PHP Kohana framework view, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.