* @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);
$object = $method->invokeArgs(null, $args);
$this->invokeAfter($class, $object);
return $object;
* 调用反射执行类的实例化 支持依赖注入
* @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);
$object = $method->invokeArgs(null, $args);
USER | www |
HOME | /home/www |
SCRIPT_NAME | /index.php |
REQUEST_URI | /center/active/390.html |
QUERY_STRING | s=/center/active/390.html |
REQUEST_METHOD | GET |
SERVER_PROTOCOL | HTTP/2.0 |
GATEWAY_INTERFACE | CGI/1.1 |
REDIRECT_QUERY_STRING | s=/center/active/390.html |
REDIRECT_URL | /center/active/390.html |
REMOTE_PORT | 36292 |
SCRIPT_FILENAME | /www/wwwroot/hnsycsh.com/public/index.php |
SERVER_ADMIN | webmaster@example.com |
CONTEXT_DOCUMENT_ROOT | /www/wwwroot/hnsycsh.com/public |
CONTEXT_PREFIX | |
REQUEST_SCHEME | https |
DOCUMENT_ROOT | /www/wwwroot/hnsycsh.com/public |
REMOTE_ADDR | 54.224.43.79 |
SERVER_PORT | 443 |
SERVER_ADDR | 42.51.25.18 |
SERVER_NAME | hnsycsh.com |
SERVER_SOFTWARE | Apache |
SERVER_SIGNATURE | <address>Apache Server at hnsycsh.com Port 443</address> |
LD_LIBRARY_PATH | /www/server/apache/lib |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin |
HTTP_HOST | hnsycsh.com |
HTTP_REFERER | http://hnsycsh.com/center/active/390.html |
HTTP_USER_AGENT | claudebot |
HTTP_ACCEPT | */* |
proxy-nokeepalive | 1 |
H2_STREAM_TAG | 3-3 |
H2_STREAM_ID | 3 |
H2_PUSHED_ON | |
H2_PUSHED | |
H2_PUSH | off |
H2PUSH | off |
HTTP2 | on |
SSL_TLS_SNI | hnsycsh.com |
HTTPS | on |
REDIRECT_STATUS | 200 |
REDIRECT_H2_STREAM_TAG | 3-3 |
REDIRECT_H2_STREAM_ID | 3 |
REDIRECT_H2_PUSHED_ON | |
REDIRECT_H2_PUSHED | |
REDIRECT_H2_PUSH | off |
REDIRECT_H2PUSH | off |
REDIRECT_HTTP2 | on |
REDIRECT_SSL_TLS_SNI | hnsycsh.com |
REDIRECT_HTTPS | on |
FCGI_ROLE | RESPONDER |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1711711388.8039 |
REQUEST_TIME | 1711711388 |