簡體   English   中英

無法打開流:無法分配請求的地址

[英]failed to open stream: Cannot assign requested address

我正在使用這樣的代碼:

echo file_get_contents('https://example.com/file.txt');

作為回應,我收到一個錯誤:

警告: file_get_contents( https://example.com/file.txt ):無法打開流:無法在第2行的 /sites/example.com/test.php 中分配請求的地址

據我了解,如果文件位於同一服務器上,則服務器出於某種原因禁止訪問 file_get_contents () 函數。 因為這樣的查詢有效:

echo file_get_contents('https://example.org');

請幫幫我。 往哪個方向挖?

在 /etc/hosts 文件中

127.0.1.1 example.com example

取而代之

external_ip of example.com example

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM