在这个主题上尝试了大多数建议的答案,似乎没有一个对我有用。
我使用MAMP在我的localhost上安装了wordpress,现在在我的functions.php中我正在尝试以下代码:
require_once('framework/functions/core-functions.php' );
我收到此错误:
Warning: require_once(framework/functions/core-functions.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/wordpress/wp-content/themes/mytheme/functions.php on line 443
Fatal error: require_once(): Failed opening required 'framework/functions/core-functions.php' (include_path='.:/Applications/MAMP/bin/php/php5.6.10/lib/php') in /Applications/MAMP/htdocs/wordpress/wp-content/themes/mytheme/functions.php on line 443
由于
答案 0 :(得分:0)
首先将当前路径设置为变量,然后设置相对于该变量的路径。
$path = realpath(dirname(__FILE__));
require "$path/framework/functions/core-functions.php";