* @param string $class 类名
* @param array $vars 参数
* @return mixed
*/
public function invokeClass(string $class, array $vars = [])
{
try {
$reflect = new ReflectionClass($class);
} catch (ReflectionException $e) {
throw new ClassNotFoundException('class not exists: ' . $class, $class, $e);
}
if ($reflect->hasMethod('__make')) {
$method = $reflect->getMethod('__make');
if ($method->isPublic() && $method->isStatic()) {
$args = $this->bindParams($method, $vars);
return $method->invokeArgs(null, $args);
}
}
* 调用反射执行类的实例化 支持依赖注入
* @access public
* @param string $class 类名
* @param array $vars 参数
* @return mixed
*/
public function invokeClass(string $class, array $vars = [])
{
try {
$reflect = new ReflectionClass($class);
} catch (ReflectionException $e) {
throw new ClassNotFoundException('class not exists: ' . $class, $class, $e);
}
if ($reflect->hasMethod('__make')) {
$method = $reflect->getMethod('__make');
if ($method->isPublic() && $method->isStatic()) {
$args = $this->bindParams($method, $vars);
return $method->invokeArgs(null, $args);
USER | www |
HOME | /home/www |
SCRIPT_NAME | /index.php |
REQUEST_URI | /plist/47 |
QUERY_STRING | |
REQUEST_METHOD | GET |
SERVER_PROTOCOL | HTTP/1.1 |
GATEWAY_INTERFACE | CGI/1.1 |
REDIRECT_URL | /plist/47 |
REMOTE_PORT | 37598 |
SCRIPT_FILENAME | /www/wwwroot/cms.cyykwl.com/public/index.php |
SERVER_ADMIN | webmaster@example.com |
CONTEXT_DOCUMENT_ROOT | /www/wwwroot/cms.cyykwl.com/public |
CONTEXT_PREFIX | |
REQUEST_SCHEME | http |
DOCUMENT_ROOT | /www/wwwroot/cms.cyykwl.com/public |
REMOTE_ADDR | 3.237.24.82 |
SERVER_PORT | 80 |
SERVER_ADDR | 122.114.158.137 |
SERVER_NAME | lnhyaz.com |
SERVER_SOFTWARE | Apache |
SERVER_SIGNATURE | <address>Apache Server at lnhyaz.com Port 80</address> |
LD_LIBRARY_PATH | /www/server/apache/lib |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin |
HTTP_HOST | lnhyaz.com |
HTTP_USER_AGENT | claudebot |
HTTP_ACCEPT | */* |
proxy-nokeepalive | 1 |
REDIRECT_STATUS | 200 |
REDIRECT_PATH_INFO | plist/47 |
FCGI_ROLE | RESPONDER |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1711698985.3487 |
REQUEST_TIME | 1711698985 |