![](/img/trans.png)
[英]Debian 6.0.7, allow_url_fopen and allow_url_include in php.ini set, but still can't include remote files?
[英]editing php.ini mac osx allow_url_include
我想將URL的確切輸出完全包含在我的網頁中
我正在使用的代碼是
$html = file_get_html("http://api.zoopla.co.uk/api/v1/area_value_graphs.js?area=" .$postcode. "&output_type=outcode&api_key=6fg3fbrxqhjkn4mkfrxdu2sr");
$data = json_decode($html, true);
$result1 = $data['average_values_graph_url'];
include $result1;
我得到的錯誤是該類型的
警告:include():服務器配置中通過allow_url_include = 0禁用了http://包裝器
我嘗試將php.ini文件編輯為allow_url_include = On
並重新啟動了我的機器,但我仍然遇到相同的錯誤。 我似乎找不到phpinfo();
給出的其他配置文件phpinfo();
而且看不到為什么我所做的更改不起作用。 我做錯了什么?
在終端中使用php --ini查找php.ini文件的位置並更改指令。 您還需要為此設置allow_url_fopen。 使用file_get_contents()。
是的,在獲取圖像時,file_get_contents()會產生嚴格的要求,它將獲取圖像代碼並轉換為字符串。 在您的字符串中顯示為GIF,表示您正在讀取圖像文件。
他們不能同時打開,因為錯誤提示它沒有打開。 回顯phpinfo()並查看那里。
用戶無法使用ini_set或類似的選項來更改某些參數,allow_url_fopen是其中之一-PHP_INI_SYSTEM類型,如果在服務器范圍內禁用了該參數,則需要在其中啟用。
在Mac的內置php上,您的.ini應該在/etc/php.ini中進行檢查。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.