【发布时间】:2010-04-11 17:23:44
【问题描述】:
我想根据当前文件路径找到一种方法来包含一些文件..例如:
我有“website.com/templates/name1/index.php”,这个“index.php”应该是一个独特的文件,我将在不同深度的许多不同目录中使用它,所以我想让代码通用所以我不需要更改此文件中的任何内容..
所以如果这个“index.php”位于
“website.com/templates/name1/index.php”
它应该包含位于此处的文件:
“website.com/content/templates/name1/content.php”
另一个例子:
“website.com/templates/name2/index.php”
它应该包含位于此处的文件:
“website.com/content/templates/name2/content.php”
我还想超越“警告:include_once() [function.include-once]: http:// wrapper is disabled in server configuration by allow_url_include=0”之类的错误..因为被禁用且不安全..
有没有办法做到这一点? 谢谢!
【问题讨论】:
标签: php dynamic include filenames