我想找到一种方法,根据当前文件路径来包含一些文件。例如:
我有一个"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"。
此外,我希望解决“Warning: include_once() [function.include-once]: http:// wrapper is disabled in the server configuration by allow_url_include=0”这种错误,因为它被禁用并且不安全。
有没有办法实现这一点?谢谢!
我有一个"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"。
此外,我希望解决“Warning: include_once() [function.include-once]: http:// wrapper is disabled in the server configuration by allow_url_include=0”这种错误,因为它被禁用并且不安全。
有没有办法实现这一点?谢谢!