Home > Backend Development > PHP Tutorial > include_once"/include/a.php" 和include_once" . /include/a.php"有什么区别?解决办法

include_once"/include/a.php" 和include_once" . /include/a.php"有什么区别?解决办法

WBOY
Release: 2016-06-13 13:47:07
Original
901 people have browsed it

include_once"./include/a.php" 和include_once". . /include/a.php"有什么区别???
include_once"./include/a.php" 和include_once". . /include/a.php"有什么区别???

------解决方案--------------------
着是绕口令嘛?
根据引用文件的位置不同,引入文件路径不同,路径不一样自然功能就不一样 
一个是当前目录下的/include/a.php
一个是根目录下的/include/a.php

/include/include/include.php
/include/a.php
/include/include/a.php

如果当前引用的文件在include/include 下的include.php
include_once"./include/a.php" 
 那么它将引用include/include/a.php

include_once". . /include/a.php"
它将引用include/a.php

/include.php
/include/a.php
/include/include/a.php
如果引用是在根目录下 include.php
那么上面两个引用将指向同一个文件. /include/a.php

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template