ThinkPHP3.2.2 is used in the environment. If a namespace problem occurs, it cannot be used! File {code...} error {code...} Environment
ThinkPHP3.2.2 is used, and the namespace cannot be used!
File
#/Application/Common/Common/Api/WebServer.phpnamespace Common\Api;class WebServer { public function demo(){ var_dump( __NAMESPACE__ ); var_dump( __FILE__ , __LINE__ ); }}
#/Application/Home/Controller/InitController. class. phpnamespace Home \ Controller; use Think \ Controller; use Common \ Api; class IndexController extend Controller {public function index () {// introduced/Application/Common/Api/WebServer. php load ('common. api. webserver ');}}
#/Application/Home/Controller/IndexController.class.phpnamespace Home\Controller;class IndexController extend InitController { public function index(){ $demo = new WebServer(); var_dump( $demo->demo() ); }}
Error
# Error message returned when accessing the index module of the HomeController Controller: Class 'home \ Controller \ webserver' not found
Reply content: Environment
ThinkPHP3.2.2 is used, and the namespace cannot be used!
File
#/Application/Common/Common/Api/WebServer.phpnamespace Common\Api;class WebServer { public function demo(){ var_dump( __NAMESPACE__ ); var_dump( __FILE__ , __LINE__ ); }}
#/Application/Home/Controller/InitController. class. phpnamespace Home \ Controller; use Think \ Controller; use Common \ Api; class IndexController extend Controller {public function index () {// introduced/Application/Common/Api/WebServer. php load ('common. api. webserver ');}}
#/Application/Home/Controller/IndexController.class.phpnamespace Home\Controller;class IndexController extend InitController { public function index(){ $demo = new WebServer(); var_dump( $demo->demo() ); }}
Error
# Error message returned when accessing the index module of the HomeController Controller: Class 'home \ Controller \ webserver' not found