超级noob问题...获取相对路径
文件来源: www.mysite.com/blah/blah/customdir/ajax/folder/file.php
,我想包括来源:
www.mysite.com/blah/blah/customdir/include/func/functions.php
所以我曾尝试:
require_once('.../include/func/functions.php');
require_once('../include/func/functions.php');
require_once('././include/func/functions.php');
和大量的其他变化。我如何得到它?在每个文件上设置顶级路径不是一个选项(这就是功能文件的用途...)
上面的每个给我一个错误: 警告:包括(././ include/func/functions.php)[function.include]:未能打开流:没有这样的文件或目录在/home/mysite/public_html/mysite.com/customdir/ajax/folder/index.php在线3
警告:包含(././ include/func/functions.php)[function.include]:无法打开流:/home/mysite/public_html/mysite.com/customdir/ajax/folder/中没有这样的文件或目录第3行的index.php
警告:include()[function.include]:无法打开'././ include /func/functions.php'(include_path ='。:/ usr/lib/php:/ usr/local/lib/php')位于/home/mysite/public_html/mysite.com/customdir/ajax/folder/第3行的index.php
它的工作原理。谢谢。为什么需要两倍的时间?瘸腿......试了很多东西。 – phpmeh 2012-01-13 19:58:10
导致它是当前脚本上方的两个目录。查看更新。 – 2012-01-13 19:59:38