Search code examples
phpautoloadrequire-once

require_once problem


I have this code in the __constructor

  $this->Reliability = new Reliability("name","url");

Problem: I got an unexpected strange error:

Fatal error: Class 'Reliability' not found in "/path/"

I'm using the "__autoload" method to call the required classes, but it doesn't work when I'm calling the file in a ModalBOX Window. If I request the file outside the ModalBox evrything goes fine :(

Some tricks to fix it?

thank you very much in advance!

P.S.

this is the __autoload method:

function __autoload($className) { 
  if (file_exists($className . '.php')) {   
      require_once $className . '.php'; 
      return true; 
  }

else return false; }


Solution

  • Is your autoloader registered in the file displayed in the modalbox?