dongxian6715 2018-01-29 18:17
浏览 80
已采纳

require_once():http://在服务器配置中通过allow_url_include = 0禁用包装器

I know this error is dicussed often already, but I just can't use require or include in my function.php(xampp) without this error on the top and I don't have a php.ini file. I don't even want one, if not necessary!

I just want to include a second php file in the fuction.php. Come on that can't be so hard...

That's what I used.

require_once (get_stylesheet_directory_uri().'/index.php');

(result: http://localhost/werkstatt/wp-content/themes/twentysixteen/index.php)

I mean in this case the index.php would be inluded anyway which leads me to the second question. Why or how are some standard files like index.php already inluded?

  • 写回答

1条回答 默认 最新

  • doujian0265 2018-01-29 18:38
    关注

    index.php is not included at all, this is the entry point to PHP code execution and it is defined in your webserver config (not really precise, but should give you an idea).

    The PHP file you want to include, is it on the same server? If so, you need to include it by its filename, and not by its URL. I understand you want to include another PHP file which is part of your theme. I don't know much about wordpress and what helper functions it defines, but this seems to be the one you need to use: https://developer.wordpress.org/reference/functions/get_template_directory/.

    If it is not placed an the same server, then you just should not do this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Cubemax打好的程序无法导入keil中,怎么解决。
  • ¥15 本地部署一个javaweb项目
  • ¥15 Index was outside the bounds of the array
  • ¥15 (标签-Python|关键词-数据类型)(相关搜索:数据类型)
  • ¥15 一个识别内容的自动化脚本程序
  • ¥15 anaconda虚拟python环境部署langchain-chatchat报错
  • ¥20 matlab有约束条件下的多元函数求最小值
  • ¥50 如何隐藏网页弹出框的url地址栏
  • ¥20 metropolis算法模拟二维ising模型来计算磁化强度,fortran
  • ¥15 uniapp-typescript-vue报错