PHP hatalar.log &

1 Cevap php

Aşağıdaki gibi Yani, benim sorundur. Ben web tarayıcısı üzerinden sayfasını yüklediğinizde bu kod çalışıyor. Ama çok gibi komut satırından komut dosyası çalıştırdığınızda: "php script.php" o bombalar.

script.php olduğunu:

<?php
include_once('class.WebsiteScraper.php');
$ws = new WebsiteScraper();
$ws->test();
...
?>

class.WebsiteScraper.php olduğunu:

<?php
echo 'test';
class WebsiteScraper {
    public function test() {
        echo 'test2';
    }
}
?>

Bu hata verir:

PHP Fatal error: Call to undefined method WebsiteScraper::test() in ... on line 4

Only when called via the command line does this happen. Another thing to note, when I append an

error_log('hey there');

Script.php için, doğrusu benim hata günlüğünde daha standart üzerinden için hata atar. Web tarayıcısı çağrıldığında Ama hata günlüğüne koyar. Herhangi bir fikir?

1 Cevap