Php Basics ~~~~ The function & nbsp; view ($ view & nbsp; false) & nbsp ;{! & Nbsp; $ view & nbsp; & amp; & nbsp; $ view & nbsp; php Basics. please refer ~~~~ ,
This post was last edited by wkhegx at 22:18:50 on
function view($view = false) {
! $view && $view = $this->controller . '/' . $this->action;
include ROOT . 'view/' . $view . '.php';
}
What does $ view = $ this-> controller. '/'. $ this-> action? Adding/in the middle, division?
Define ('root', dirname (_ FILE __). '/.. /'); this _ FILE _ gets the current FILE directory, but. "/... /"What does it mean ??
------ Solution --------------------
What does $ view = $ this-> controller. '/'. $ this-> action? Adding/in the middle, division?
The operator is not the operator, but a string.
$ View = $ this-> controller. '/'. $ this-> action; concatenates $ this-> controller,/, $ this-> action, and then returns the value to $ view.
For example
$ This-> controll = 'web'
$ This-> action = 'index'
So $ view = 'web/index ';
Define ('root', dirname (_ FILE __). '/.. /'); this _ FILE _ gets the current FILE directory, but. "/... /"What does it mean ??
../Indicates the parent category
For example, the project structure is as follows:
Web/a/B/c/d. php
Then, in d. php, dirname (_ FILE _). '/../' is equivalent to web/a/B/
------ Solution --------------------
Path. Equivalent \
In php, "/" is the path character and "\" is the escape character.
------ Solution --------------------
Echo $ view;
Echo dirname (_ FILE __).'/../';
Don't you know?
Don't say you don't have a php environment