Expose “use” classes to Included file

后端 未结 1 890
一个人的身影
一个人的身影 2020-12-11 21:38

Example:

namespace Somenamespace;    
use Somenamespace\\Someclass;
use Somenamespace\\otherclass;


class Template{

  public function display($templ){
             


        
1条回答
  •  独厮守ぢ
    2020-12-11 22:20

    Simply: no. See note bellow the example http://www.php.net/manual/en/language.namespaces.importing.php#example-247

    Importing rules are per file basis, meaning included files will NOT inherit the parent file's importing rules.

    0 讨论(0)
提交回复
热议问题