PHP Basics, please guide ~

Source: Internet
Author: User
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.