abstract://thinkphp5.1中构造方法依赖注入class Index{ protected $user; public function __construct(User $user) { $this->user = $user; } &
//thinkphp5.1中构造方法依赖注入
class Index{
protected $user;
public function __construct(User $user)
{
$this->user = $user;
}
public function hello()
{
return 'Hello,' . $this->user->name ;
}
}
Correcting teacher:查无此人Correction time:2019-04-17 09:14:03
Teacher's summary:完成的不错。不过是不是代码不全,我没看到name,只看到调用了。继续加油。