php URL file-access is disabled in the server configuration

  升级到php5.2.3后,使用include()包含外部文件,会出现错误:URL file-access is disabled in the server configuration….

解决办法:修改php.ini,allow_url_include = On ,

然后重启web服务器。

再刷新看看,ok !

但是这对网站安全性会照成危害。

最好还是使用curl代码 

<?php

/* 

* @return string 

* @param string $url 

* @desc Return string content from a remote file 

* @author Luiz Miguel Axcar ([email protected]

*/ 

function get_content($url) 



$ch = curl_init(); 

curl_setopt ($ch, CURLOPT_URL, $url);

curl_setopt ($ch, CURLOPT_HEADER, 0); 

ob_start(); 

curl_exec ($ch); 

curl_close ($ch); 

$string = ob_get_contents();

ob_end_clean(); 

return $string; 



#usage: 

$content = get_content ("http://www.php.net");

var_dump ($content); 

?>

你可能感兴趣的:(PHP,server)