어제 여기에 질문을했고 다음 코드가 주어졌습니다.PHP file_get_contents가 올바르게 작동하지 않습니다.
<?php
function usd_rate(){
$json = file_get_contents("https://bitpay.com/api/rates");
$obj = json_decode($json);
if($obj->code == 'USD') return $o->rate;
}
echo usd_rate()
?>
처음에는 문제가 없었지만 공유 된 호스트를 떠나 전용 서버 호스트로 이동했습니다.
나는 아래
; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
; http://php.net/allow-url-fopen
allow_url_fopen = On
; Whether to allow include/require to open URLs (like http:// or ftp://) as fil$
; http://php.net/allow-url-include
allow_url_include = On
을 보장하기 위해 php.ini 파일을 확인했지만 여전히 값 중 하나를 보여 나던. 나는 약 2 시간 동안 이것에 붙어 있었으므로 나는 도움을 청하는 것이 현명한 생각 일 것이라고 생각했다.
아무쪼가 신경써 주셔서 감사합니다.
또한
출력 마지막 호스트가 실행중인 것을 php --version
PHP 5.5.9-1ubuntu4.4 (cli) (built: Sep 4 2014 06:56:34)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
확실하지의
'위해서 var_dump를 시도 준 코드에서 오류가 ($ json); –
'error_reporting (-1)'? 아파치 오류 로그? –
시도해보십시오. $ _SERVER [ 'DOCUMENT_ROOT']. 'api/rates'this .. – john