2016-11-24 21 views
-1

これはイライラしています。このコードは実行されず、エラーは表示されません。PHPエラーが表示されません

以下に見られるように、ページの上部にエコーがありますが、これは表示されませんが、エコーから離れて他のコードをすべて削除すると、表示されます。

PHPは手続き型ですが、以下のエラーがあってもエコーが表示されるはずです。

何が起こっているのですか?これらのエラーを表示する

<?php 
    echo "test"; 
    ini_set('display_errors', 1); 
    ini_set('display_startup_errors', 1); 
    error_reporting(E_ALL); 

    include 'models/Soccerseason.php'; 

    class FootballData { 
    public $config; 
    public $baseUri; 
    public $title; 
    public $auth = false; 

    public function __construct() { 
     $this->config = parse_ini_file('config.ini', true); 
     if($this->config['authToken'] == '4e0aa9dc285343fbb1db8251d64a38c4' || !isset($this->config['authToken'])) { 

     $this->baseUri = $this->config['baseUri']; 
     $this->reqPrefs['http']['method'] = 'GET'; 
     $this->reqPrefs['http']['header'] = 'X-Auth-Token: ' . $this->config['authToken']; 

     $this->auth = true; 
     } 
    } 

    public function getSoccerseasonById($id) { 
     echo "true"; 
     if ($this->auth == true) { 
     $result; 
     $resource = 'soccerseasons/' . $id; 
     $response = file_get_contents($this->baseUri . $resource, false, stream_context_create()); 

     if ($response == "" || $response == null) { 
      $response = file_get_contents($this->config['localBackup'] . $resource, false, stream_context_create()); 
      $result = json_decode($response); 
      $response['title'] = 'Local Copy:'; 
      $result = json_encode($response); 
     } 
     $result = json_decode($response); 

     return new Soccerseason($result); 

     } else { 
     return array('error' => 'API Key incorrect/not set, please amend in the config.'); 
     } 
    } 
    } 

    $fixtures = new FootballData->getSoccerseasonById(426); 
?> 
+0

恥を知れ。文法警察。ポストははっきりしていて、欲求不満の余分な表示だった。問題を解決するのに貢献していない、ちょうど言い直して... -_- –

答えて

1

はこのラインであなたのphp.iniを変更することです:

display_errors = on 
+0

私が追加したトップ3のラインはこれを行うだろうと思った?私はこれらの設定を変更するためにcPanelをどこでも見つけることができないようです。 –

+0

@MartynBall:PHPは 'ini_set()'で設定を変更できないように設定されているかもしれません。 'display_errors = off'では' ini_set() 'が無効になっているという警告も表示されません。 –

+0

cPanelには、ウェブサイトで生成されたエラーを表示するためのエラーログセクションがあります –

1

パースエラーがある場合echoは実行されません。最後の行には - があります。それは:$fixtures = (new FootballData)->getSoccerseasonById(426);である必要があります。

1

変更する権限がありますかphp.ini?はいの場合は、display_errorsを修正して表示されるかどうかを確認できます。サーバーログもチェックしてみてください。php.iniでエラーが出力されていても、エラーログにエラーが出力されます。

1

あなたのcPanelにログインしてください。 cPanelエラーを表示するアイコン[メトリックに移動]> [エラー]。それを取得-1による文法と私が使用言葉遣いに enter image description here

enter image description here

関連する問題