在我的wordpress页脚中,我从其他站点获得文件php。
<?php include('http://www.othersite.com/1.php'); ?>如何在本地主机上工作?
有错误:
Warning: include() [function.include]: URL file-access is disabled in the server configuration in D:\Design\AppServ\www\wordpress\wp-content\themes\mythems\footer.php on line 21
Warning: include(http://www.othersite.com/1.php) [function.include]: failed to open stream: no suitable wrapper could be found in D:\Design\AppServ\www\wordpress\wp-content\themes\mythems\footer.php on line 21
Warning: include() [function.include]: Failed opening 'http://www.othersite.com/1.php' for inclusion (include_path='.;C:\php5\pear') in D:\Design\AppServ\www\wordpress\wp-content\mythems\halongcruise\footer.php on line 21谢谢
发布于 2014-04-26 04:53:36
如果您只想获得内容并将其显示在您的页脚上,那么我们可以这样做:
<?php
$response = wp_remote_get('http://www.othersite.com/1.php');
echo wp_remote_retrieve_body( $response );
?>发布于 2014-04-26 04:44:55
试试这个:
解决方案1:
在php.ini上添加或取消注释下面的行
allow_url_fopen = ON重新启动apache。
解决方案2:
将以下内容添加到.htaccess文件中:
php_flag allow_url_fopen onhttp://www.solo-technology.com/blog/2010/04/07/quick-fix-for-url-file-access-is-disabled-issues/
发布于 2014-04-26 04:50:57
如果希望包含来自不同服务器的文件,则需要允许包含远程文件,则必须在allow_url_include php.ini中将指令设置为On。默认情况下,此设置在大多数web服务器(php.ini)中是禁用/不允许的,因此出于安全原因,您不能使用包含包含来自远程地址的文件。
从安全的角度来看,这种做法是不好的。所以不管你想做什么,记住我想说的话。
如果您不想包含其他站点文件,那么从服务器中包含一个文件很简单,例如,
<?php include('1.php'); ?> //Use relative or absolute path inside include参考资料:include.html
https://stackoverflow.com/questions/23306709
复制相似问题