【发布时间】:2011-10-27 19:48:08
【问题描述】:
我需要将一个 PHP 文件包含到另一个文件中。不过,需要包含的 PHP 文件位于单独的目录中。它是这样设置的:
folder1/global-functions.php
folder1/folder2/functions.php
我需要在“functions.php”中包含“global-functions.php”
我试过了:
<?php include("../global-functions.php"); ?>
但这行不通。它返回此错误消息:
警告:include(../global-functions.php) [function.include]:无法打开流:/home/user/public_html/wp-content/themes/folder1/folder2/ 中没有这样的文件或目录第 2 行的 custom_functions.php
警告:include() [function.include]: 未能打开 '../global-functions.php' 以包含 (include_path='.:/usr/lib/php:/usr/local/lib/php' ) 在 /home/user/public_html/wp-content/themes/folder1/folder2/custom_functions.php 第 2 行
【问题讨论】:
-
您想要包含您的全局函数,但在您的代码中,您只包含了 functions.php。 ..我认为您必须将其更改为
-
我觉得你试错了...
标签: php