升级到 php 7 后包括外部 html 站点
Include external html site after upgrading to php 7
我正在尝试将我的 php 从 v.5 升级到 v.7.2,但我遇到了这个我无法修复的错误。
我有一个包含 external 页眉和页脚的 tpl 文件,但它们不会再加载了。
这是错误(*请注意:故意添加空格*):
Warning: include(): Failed opening 'https: //mywebsite.com/folder1/includes/wrappers/footer.html' for inclusion (include_path='.;C:\php\pear') in * folderpath*\bottom_page.html on line 86
在主 tpl 文件中(我们称它为 "home.tpl")我在页脚处有这一行:
<?php include dirname( __ FILE__)."\bottom_page.html" ; ?>
在 bottom_page.html 我有一些脚本看起来不错,最后是这一行:
<?php include('https: //mywebsite.com/folder1/includes/wrappers/footer.html'); ?>
好像是这一行的问题,找了很多都没有找到解决办法
这是我试过的:
- 验证 allow_url_fopen & php.ini 中的 allow_url_include 是 1
- 使用 readfile 或 file_get_contents 而不是 include
还有什么建议吗? :)
p.s: url 正确,浏览器显示了我想要包含的内容..
好的,所以我找到了解决方案 - 最后:
php include to external url
来自 Nicholas Valbusa 的评论,curl 用法有效:)
我正在尝试将我的 php 从 v.5 升级到 v.7.2,但我遇到了这个我无法修复的错误。 我有一个包含 external 页眉和页脚的 tpl 文件,但它们不会再加载了。 这是错误(*请注意:故意添加空格*):
Warning: include(): Failed opening 'https: //mywebsite.com/folder1/includes/wrappers/footer.html' for inclusion (include_path='.;C:\php\pear') in * folderpath*\bottom_page.html on line 86
在主 tpl 文件中(我们称它为 "home.tpl")我在页脚处有这一行:
<?php include dirname( __ FILE__)."\bottom_page.html" ; ?>
在 bottom_page.html 我有一些脚本看起来不错,最后是这一行:
<?php include('https: //mywebsite.com/folder1/includes/wrappers/footer.html'); ?>
好像是这一行的问题,找了很多都没有找到解决办法 这是我试过的:
- 验证 allow_url_fopen & php.ini 中的 allow_url_include 是 1
- 使用 readfile 或 file_get_contents 而不是 include
还有什么建议吗? :)
p.s: url 正确,浏览器显示了我想要包含的内容..
好的,所以我找到了解决方案 - 最后:
php include to external url
来自 Nicholas Valbusa 的评论,curl 用法有效:)