PHP Basics, please guide ~ ~ ~ ~,
This post was last edited by wkhegx on 2014-06-11 22:18:50
function view ($view = False) {
! $view && $view = $this->controller. '/' . $this->action;
Include ROOT. ' view/'. $view. '. php ';
}
Excuse me $view = $this->controller. '/' . $this->action; What is the meaning? Middle Plus/, is not except
Define (' ROOT ', DirName (__file__). '/.. /' ); This __file__ gets the current file directory, but later. " /.. /"What does that mean??
------Solution--------------------
Excuse me $view = $this->controller. '/' . $this->action; What is the meaning? Middle Plus/, is not except
The middle/Not the operator, but a string.
$view = $this->controller. '/' . $this->action; $this->controller,/, $this->action splicing, and then gifted value to $view
For example
$this->controll = ' web '
$this->action = ' index '
Then $view = ' web/index ';
Define (' ROOT ', DirName (__file__). '/.. /' ); This __file__ gets the current file directory, but later. " /.. /"What does that mean??
.. /Show Parent
For example, the structure of the catalogue is as follows
web/a/b/c/d.php
Then DirName (__file__) in the d.php. '/.. /' equal to web/a/b/
------Solution--------------------
Path. Equivalent to the middle of c:\www\index.html \
PHP is a/is a path character, \ is an escape character.
------Solution--------------------
Echo $view;
echo dirname (__file__). '/.. /';
Look, you know what?
Don't say you don't have a PHP environment