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 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程