我研究Laravel框架源代码。我达到了以下命令。
class Application extends Container implements ApplicationContract, HttpKernelInterface
{
public function handle(SymfonyRequest $request, $type = self::MASTER_REQUEST, $catch = true)
{
return $this[HttpKernelContract::class]->handle(Request::createFromBase($request));
}
}
所以,我需要知道php语法中 $ this [MyClass:class] - > someMethod()短语的含义。
是$this
数组吗?!怎么样?
由于
答案 0 :(得分:3)
课程Application
扩展了Container
,$this[HttpKernelContract::class]
本身实现ArrayAccess
,因此$this->offsetGet(HttpKernelContract::class)
基本上会调用Container
, {
"question": "Is this useful",
"options": [
"yes",
"no"
]
}
应该实现。{ / p>