[英]I want to include code from the web on php. Example: require "domain.com/folder/file.php";
我需要从我的网络中包含一些变量和代码,我使用了include "example.com/folder/file.php";
,而且我无法从我的网络中包含此文件。 我有一个付费托管。
我收到这些错误:
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in
C:\xampp\htdocs\folder\file.php on line 8
W arning: include(http:/example.com/folder/file.php): failed to open
stream: no suitable wrapper could be found in
C:\xampp\htdocs\folder\file.php on line 8
Warning: include(): Failed opening 'http://example.com/folder/file.php'
for inclusion (include_path='C:\xampp\php\PEAR') in
C:\xampp\htdocs\folder\file.php on line 8
(“example.com/folder/file.php”和“C:\\xampp\\htdocs\\folder\\file.php”是用于保护我的隐私的说明性网址)
我希望你能帮助我。 谢谢!
您也许可以将此行放在脚本的开头
ini_set('allow_url_include',1);
如果这不起作用,请参阅如何定位 php.ini 文件 (xampp)并更新 php.ini 文件中的allow_url_include设置。
您的问题的可能解决方案——制作您自己的网络服务:
// local script
$localVersion = '1.0.0';
$remoteVersion = '';
// get remote version as json
if( $remote = json_decode(file_get_contents('http://example.com/version.php')) {
// $remoteVersion=$remote['version'];
$remoteVersion=$remote->version
}
if( $localVersion < $remoteVersion ) {
// do whatever...
}
远程脚本(version.php)
// load your initialization, or just set
$version = '1.3.0';
header('Content-Type: application/json');
echo json_encode(['version'=>$version]);
die;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.