依赖注入小案例

Original 2020-02-01 12:22:46 252
abstract:<?php namespace app\index\controller; use app\index\model\User; class Index {    protected $user;    public function __construct(User $user)    {    

<?php namespace app\index\controller; use app\index\model\User; class Index {    protected $user;    public function __construct(User $user)    {        $this->user = $user;    }    public function hello()    {        return 'Hello,' . $this->user->name . '!';    } }依赖注入

Correcting teacher:天蓬老师Correction time:2020-03-08 17:35:48
Teacher's summary:代码应该放在代码块中, 并且格式化后再提交

Release Notes

Popular Entries