Rumah >pembangunan bahagian belakang >tutorial php > include_once"/include/a.php" 和include_once" . /include/a.php"有什么区别?解决办法
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