Fatal Error Class not found - Namespace PHP

Asked

Viewed 1,781 times

1

Hello I am using the following php codes

<?php
namespace lab312\database;

class ScriptFactory

{


function __construct()
{

}

//outras funcionalidades


}

and

<?php
namespace  lab312\database\testes;
use lab312\database\ScriptFactory;

/* arquivo t.php*/
$script = new ScriptFactory();    

however when I call the Scriptfactory class the following error:

Fatal error: Class 'lab312 database Scriptfactory' not found in t.php on line 17

any hint?

  • 1

    is missing the autoloader. PS: If the downvoter can manifest... is a completely valid doubt.

  • Isn’t the fact that "tests" are in the namespace of the second file causing Scriptfactory to be searched within it? Try the following to see if you solve: $script = new lab312 database Scriptfactory();

  • Opa... missing a include/require from the first file in the second! Already did this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.