Phpnamespace and use problems create a C. php file under the test folder, Content & lt ;? Phpnamespace & nbsp; TestDriver; class & nbsp; C {function & nbsp; test () {echo & nbsp; c ;}}? & Gt; create the test. php file. Content & lt ;! DOCTYPE & nbsp; html & nb php namespace and use problems
Create a C. php file in the/test folder.
Namespace Test \ Driver;
Class C
{
Function test ()
{
Echo "c ";
}
}
?>
/.
Untitled Document
Include "test/C. php ";
Use Test \ Driver;
$ C = new C ();
$ C-> test ();
Echo"
";
?>
Running error:
(! ) SCREAM: Error suppression ignored
(! ) Fatal error: Class 'C' not found in E: \ hongyunlai \ thinkphp32 \ test. php on line 14
Call Stack
# Time Memory Function Location
1 0.0006 247520 {main} () .. \ test. php: 0
------ Solution --------------------
Your namespace is Test \ Driver
$ C = new Driver \ C (); just take the last section of the namespace.