警告:include():http://在服务器配置中禁用了包装器

时间:2017-03-22 11:13:46

标签: php wordpress cpanel

我试图在wordpress中创建一个插件 这是我的代码

 include plugins_url("/imp-file/admin/partials/imp-file-admin-display.php");

那是警告

> Warning: include(): http:// wrapper is disabled in the server
> configuration by allow_url_include=0 in
> /home/darelizza/public_html/wp-content/plugins/imp-file/admin/class-imp-file-admin.php
> on line 120
> 
> Warning:
> include(http://darelizza.com/wp-content/plugins/imp-file/admin/partials/imp-file-admin-display.php):
> failed to open stream: no suitable wrapper could be found in
> /home/darelizza/public_html/wp-content/plugins/imp-file/admin/class-imp-file-admin.php
> on line 120
> 
> Warning: include(): Failed opening
> 'http://darelizza.com/wp-content/plugins/imp-file/admin/partials/imp-file-admin-display.php'
> for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in
> /home/darelizza/public_html/wp-content/plugins/imp-file/admin/class-imp-file-admin.php
> on line 120

2 个答案:

答案 0 :(得分:0)

不要使用plugins_url。试试这个:

include plugins_dir_path("/imp-file/admin/partials/imp-file-admin-
display.php");

答案 1 :(得分:0)

  1. 创建一个在基类中定义插件路径变量的结构:

    define( 'XPlugin_PLUGIN_PATH', plugin_dir_path(__FILE__) );

  2. 然后将其用作include函数中的参数,如下所示:

    include( XPlugin_PLUGIN_PATH. '/admin/partials/XPlugin-admin-display.php');