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

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.

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

报告相同问题?

悬赏问题

  • ¥50 array数据同步问题
  • ¥15 pic16F877a单片机的外部触发中断程序仿真失效
  • ¥15 Matlab插值拟合差分微分规划图论
  • ¥15 keil5 target not created
  • ¥15 C/C++数据与算法请教
  • ¥15 怎么找志同道合的伙伴
  • ¥20 如何让程序ab.eXe自已删除干净硬盘里的本文件自己的ab.eXe文件
  • ¥50 爬虫预算充足,跪巨佬
  • ¥15 滑块验证码拖动问题悬赏
  • ¥15 Wanted but not invoked:Actually, there were zero interactions with this moc