0

下面的 PHP 函数产生了这个错误: Parse error: syntax error, unexpected ',', on this line that content this code:( $className, new $this->registerService( $service ) );

有谁知道出了什么问题?

function lazyCreateSingletonServiceByClassName($className) {
    $service = $this->createContextAwareObjectOfClass( $className );

    if (method_exists( $service, 'init' )) {
        $service->init(  );
    }

    SingletonServiceProvider;
    ( $className, new $this->registerService( $service ) );


}

坦克

4

1 回答 1

5

我不能确切地说出这里发生了什么,但我认为

SingletonServiceProvider;
( $className, new $this->registerService( $service ) );

应该

SingletonServiceProvider( $className, new $this->registerService( $service ) );
于 2013-01-30T01:01:31.607 回答