A. php has a namespace {code ...} in the factory. php {code ...} why in factory. the createA method in php will tell me that I cannot find fooclassA in factory. php... it should go to. php. It can be used in php.5.5. php), but in step 5 .... a. php has a namespace.
namespace foo;class classA{ public function foo_test(){ echo "this is instance function"; } }
In factory. php
namespace factory;import('a.php');class classB{ public function createA(){ return \foo\classA::foo_test(); }}
Why in factory. the createA method in php will tell me that I cannot find \ foo \ classA in factory. php... it should go to. php. It can be used in php.5.5. php), but after 5.6, it will find (factory. php)
How can I solve this problem...
Reply content:
A. php has a namespace.
namespace foo;class classA{ public function foo_test(){ echo "this is instance function"; } }
In factory. php
namespace factory;import('a.php');class classB{ public function createA(){ return \foo\classA::foo_test(); }}
Why in factory. the createA method in php will tell me that I cannot find \ foo \ classA in factory. php... it should go to. php. It can be used in php.5.5. php), but after 5.6, it will find (factory. php)
How can I solve this problem...
PHP supports the following reference methods:
Require (file_path );
Require_once (file_path _;
Include (file_path );
Include_once (file_path );
Use 'file _ path ';
Specific differences go to google
Finally, I want to ask, what are you writing ???
Php does not seem to have the import () built-in method...
Just change it according to the @ lanffy brother...