Home >Backend Development >PHP Tutorial > php namespace 工场模式new 类

php namespace 工场模式new 类

WBOY
WBOYOriginal
2016-06-13 12:43:13827browse

php namespace 工厂模式new 类

function factory($class) {
    $class = '\\' . __NAMESPACE__ . '\\' . $class;
    return new $class;
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn