>백엔드 개발 >PHP 튜토리얼 > include_once"/include/a.php" 和include_once" . /include/a.php"有什么区别?解决办法

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

WBOY
WBOY원래의
2016-06-13 13:47:07899검색

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

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.