Warning: require_once(): http:// wrapper is disabled in the server configuration by allow_url_include=0

前端 未结 9 1966
自闭症患者
自闭症患者 2020-12-02 15:44

I am trying to include a php file in a page via

  require_once(http://localhost/web/a.php)

I am getting an error

 Warning:         


        
9条回答
  •  半阙折子戏
    2020-12-02 16:05

    I had this same error while trying to include a PHP file in my Wordpress theme. I was able to get around it by referencing the file name using dirname(__FILE__). I couldn't use relative paths since my file was going to be included in different places throughout the theme, so something like require_once '../path-to/my-file' wouldn't work.

    Replacing require_once get_template_directory_uri() . '/path-to/my-file' with require_once dirname( __FILE__ ) . '/path-to/my-file' did the trick.

提交回复
热议问题