我试图在使用相对文件路径的不同目录中包含一个文件,但我一直得到错误:
failed to open stream: No such file or directory
调用include语句的文件的路径是
wp-content/plugins/php-code-widget/execphp.php
,我要包含的文件是
wp-content/uploads/espresso/templates/sidebar_widgets/register_widget.php
这是我的include语句:
<?php include ('../../uploads/espresso/templates/sidebar_widgets/register_widget.php ?>
有人看到问题了吗?
我会避免使用相对路径。
只要WordPress自我上次使用以来没有太大的变化,试试这样做…
include ABSPATH .
'wp-content/uploads/espresso/templates/sidebar_widgets/register_widget.php';