第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

老師能幫下我嗎

請(qǐng)問錯(cuò)哪里了呢

http://img1.sycdn.imooc.com//58b67972000179ed10040582.jpg

http://img1.sycdn.imooc.com//58b679730001391308970440.jpg

和老師的代碼一模一樣的,

我復(fù)制下代碼

<?php

namespace app\controllers;

use yii\base\Controller;

use yii\di\Container;


class DependencyController extends Controller{

public function actionIndex(){

$container = new Container;

$container->set('app\Controllers\Driver','app\Controllers\ManDriver');

$car = $container->get('app\Controllers\Car'); ? ? ?//因?yàn)樯厦嬉呀?jīng)指定了命名空間,所有的話這也要加上命名空間

//上面這個(gè)get方法實(shí)際上做了兩件事如下注釋的兩件事,就是如果下面的car中的__construct()有傳遞ManDriver對(duì)象的情況下

// $driver = new ManDriver; ? //第一步是先實(shí)例化ManDriver

// $car = new Car($driver); ? //第二部是實(shí)例化Car對(duì)象

$car->run();

}

}


interface Driver{

public function drive();

}


class ManDriver implements Driver{ ? ? ?//繼承Driver接口,目的是為了解決強(qiáng)關(guān)聯(lián)

public function drive(){

echo "i am an old man!";

}

}


class Car{

private $driver = null;

public function __construct(Driver $driver){ ? ?//通過構(gòu)造來傳遞司機(jī)對(duì)象,如果加了ManDriver對(duì)象實(shí)例這樣傳遞會(huì)造成強(qiáng)關(guān)聯(lián)

$this->driver = $driver;

}

public function run(){

$this->driver->drive();

}

}


正在回答

3 回答


【蜘蛛俠TG@abin789】-3401
【蜘蛛俠TG@abin789】-3402
【蜘蛛俠TG@abin789】-3403
【蜘蛛俠TG@abin789】-3404
【蜘蛛俠TG@abin789】-3405
【蜘蛛俠TG@abin789】-3406
【蜘蛛俠TG@abin789】-3407
【蜘蛛俠TG@abin789】-3408
【蜘蛛俠TG@abin789】-3409
【蜘蛛俠TG@abin789】-3410
【蜘蛛俠TG@abin789】-3411
【蜘蛛俠TG@abin789】-3412
【蜘蛛俠TG@abin789】-3413
【蜘蛛俠TG@abin789】-3414
【蜘蛛俠TG@abin789】-3415
【蜘蛛俠TG@abin789】-3416
【蜘蛛俠TG@abin789】-3417
【蜘蛛俠TG@abin789】-3418
【蜘蛛俠TG@abin789】-3419
【蜘蛛俠TG@abin789】-3420
【蜘蛛俠TG@abin789】-3421
【蜘蛛俠TG@abin789】-3422
【蜘蛛俠TG@abin789】-3423
【蜘蛛俠TG@abin789】-3424
【蜘蛛俠TG@abin789】-3425
【蜘蛛俠TG@abin789】-3426
【蜘蛛俠TG@abin789】-3427
【蜘蛛俠TG@abin789】-3428
【蜘蛛俠TG@abin789】-3429
【蜘蛛俠TG@abin789】-3430
【蜘蛛俠TG@abin789】-3431
【蜘蛛俠TG@abin789】-3432
【蜘蛛俠TG@abin789】-3433
【蜘蛛俠TG@abin789】-3434
【蜘蛛俠TG@abin789】-3435
【蜘蛛俠TG@abin789】-3436
【蜘蛛俠TG@abin789】-3437
【蜘蛛俠TG@abin789】-3438
【蜘蛛俠TG@abin789】-3439
【蜘蛛俠TG@abin789】-3440
【蜘蛛俠TG@abin789】-3441
【蜘蛛俠TG@abin789】-3442
【蜘蛛俠TG@abin789】-3443
【蜘蛛俠TG@abin789】-3444
【蜘蛛俠TG@abin789】-3445
【蜘蛛俠TG@abin789】-3446
【蜘蛛俠TG@abin789】-3447
【蜘蛛俠TG@abin789】-3448
【蜘蛛俠TG@abin789】-3449
【蜘蛛俠TG@abin789】-3450
【蜘蛛俠TG@abin789】-3451
【蜘蛛俠TG@abin789】-3452
【蜘蛛俠TG@abin789】-3453
【蜘蛛俠TG@abin789】-3454
【蜘蛛俠TG@abin789】-3455
【蜘蛛俠TG@abin789】-3456
【蜘蛛俠TG@abin789】-3457
【蜘蛛俠TG@abin789】-3458
【蜘蛛俠TG@abin789】-3459
【蜘蛛俠TG@abin789】-3460
【蜘蛛俠TG@abin789】-3461
【蜘蛛俠TG@abin789】-3462
【蜘蛛俠TG@abin789】-3463
【蜘蛛俠TG@abin789】-3464
【蜘蛛俠TG@abin789】-3465
【蜘蛛俠TG@abin789】-3466
【蜘蛛俠TG@abin789】-3467
【蜘蛛俠TG@abin789】-3468
【蜘蛛俠TG@abin789】-3469
【蜘蛛俠TG@abin789】-3470
【蜘蛛俠TG@abin789】-3471
【蜘蛛俠TG@abin789】-3472
【蜘蛛俠TG@abin789】-3473
【蜘蛛俠TG@abin789】-3474
【蜘蛛俠TG@abin789】-3475
【蜘蛛俠TG@abin789】-3476
【蜘蛛俠TG@abin789】-3477
【蜘蛛俠TG@abin789】-3478
【蜘蛛俠TG@abin789】-3479
【蜘蛛俠TG@abin789】-3480
【蜘蛛俠TG@abin789】-3481
【蜘蛛俠TG@abin789】-3482
【蜘蛛俠TG@abin789】-3483
【蜘蛛俠TG@abin789】-3484
【蜘蛛俠TG@abin789】-3485
【蜘蛛俠TG@abin789】-3486
【蜘蛛俠TG@abin789】-3487
【蜘蛛俠TG@abin789】-3488
【蜘蛛俠TG@abin789】-3489
【蜘蛛俠TG@abin789】-3490
【蜘蛛俠TG@abin789】-3491
【蜘蛛俠TG@abin789】-3492
【蜘蛛俠TG@abin789】-3493
【蜘蛛俠TG@abin789】-3494
【蜘蛛俠TG@abin789】-3495
【蜘蛛俠TG@abin789】-3496
【蜘蛛俠TG@abin789】-3497
【蜘蛛俠TG@abin789】-3498
【蜘蛛俠TG@abin789】-3499
【蜘蛛俠TG@abin789】-3500
【蜘蛛俠TG@abin789】-3501
【蜘蛛俠TG@abin789】-3502
【蜘蛛俠TG@abin789】-3503
【蜘蛛俠TG@abin789】-3504
【蜘蛛俠TG@abin789】-3505
【蜘蛛俠TG@abin789】-3506
【蜘蛛俠TG@abin789】-3507
【蜘蛛俠TG@abin789】-3508
【蜘蛛俠TG@abin789】-3509
【蜘蛛俠TG@abin789】-3510
【蜘蛛俠TG@abin789】-3511
【蜘蛛俠TG@abin789】-3512
【蜘蛛俠TG@abin789】-3513
【蜘蛛俠TG@abin789】-3514
【蜘蛛俠TG@abin789】-3515
【蜘蛛俠TG@abin789】-3516
【蜘蛛俠TG@abin789】-3517
【蜘蛛俠TG@abin789】-3518
【蜘蛛俠TG@abin789】-3519
【蜘蛛俠TG@abin789】-3520
【蜘蛛俠TG@abin789】-3521
【蜘蛛俠TG@abin789】-3522
【蜘蛛俠TG@abin789】-3523
【蜘蛛俠TG@abin789】-3524
【蜘蛛俠TG@abin789】-3525
【蜘蛛俠TG@abin789】-3526
【蜘蛛俠TG@abin789】-3527
【蜘蛛俠TG@abin789】-3528
【蜘蛛俠TG@abin789】-3529
【蜘蛛俠TG@abin789】-3530
【蜘蛛俠TG@abin789】-3531
【蜘蛛俠TG@abin789】-3532
【蜘蛛俠TG@abin789】-3533
【蜘蛛俠TG@abin789】-3534
【蜘蛛俠TG@abin789】-3535
【蜘蛛俠TG@abin789】-3536
【蜘蛛俠TG@abin789】-3537
【蜘蛛俠TG@abin789】-3538
【蜘蛛俠TG@abin789】-3539
【蜘蛛俠TG@abin789】-3540
【蜘蛛俠TG@abin789】-3541
【蜘蛛俠TG@abin789】-3542
【蜘蛛俠TG@abin789】-3543
【蜘蛛俠TG@abin789】-3544
【蜘蛛俠TG@abin789】-3545
【蜘蛛俠TG@abin789】-3546
【蜘蛛俠TG@abin789】-3547
【蜘蛛俠TG@abin789】-3548
【蜘蛛俠TG@abin789】-3549
【蜘蛛俠TG@abin789】-3550
【蜘蛛俠TG@abin789】-3551
【蜘蛛俠TG@abin789】-3552
【蜘蛛俠TG@abin789】-3553
【蜘蛛俠TG@abin789】-3554
【蜘蛛俠TG@abin789】-3555
【蜘蛛俠TG@abin789】-3556
【蜘蛛俠TG@abin789】-3557
【蜘蛛俠TG@abin789】-3558
【蜘蛛俠TG@abin789】-3559
【蜘蛛俠TG@abin789】-3560
【蜘蛛俠TG@abin789】-3561
【蜘蛛俠TG@abin789】-3562
【蜘蛛俠TG@abin789】-3563
【蜘蛛俠TG@abin789】-3564
【蜘蛛俠TG@abin789】-3565
【蜘蛛俠TG@abin789】-3566
【蜘蛛俠TG@abin789】-3567
【蜘蛛俠TG@abin789】-3568
【蜘蛛俠TG@abin789】-3569
【蜘蛛俠TG@abin789】-3570
【蜘蛛俠TG@abin789】-3571
【蜘蛛俠TG@abin789】-3572
【蜘蛛俠TG@abin789】-3573
【蜘蛛俠TG@abin789】-3574
【蜘蛛俠TG@abin789】-3575
【蜘蛛俠TG@abin789】-3576
【蜘蛛俠TG@abin789】-3577
【蜘蛛俠TG@abin789】-3578
【蜘蛛俠TG@abin789】-3579
【蜘蛛俠TG@abin789】-3580
【蜘蛛俠TG@abin789】-3581
【蜘蛛俠TG@abin789】-3582
【蜘蛛俠TG@abin789】-3583
【蜘蛛俠TG@abin789】-3584
【蜘蛛俠TG@abin789】-3585
【蜘蛛俠TG@abin789】-3586
【蜘蛛俠TG@abin789】-3587
【蜘蛛俠TG@abin789】-3588
【蜘蛛俠TG@abin789】-3589
【蜘蛛俠TG@abin789】-3590
【蜘蛛俠TG@abin789】-3591
【蜘蛛俠TG@abin789】-3592
【蜘蛛俠TG@abin789】-3593
【蜘蛛俠TG@abin789】-3594
【蜘蛛俠TG@abin789】-3595
【蜘蛛俠TG@abin789】-3596
【蜘蛛俠TG@abin789】-3597
【蜘蛛俠TG@abin789】-3598
【蜘蛛俠TG@abin789】-3599
【蜘蛛俠TG@abin789】-3600

0 回復(fù) 有任何疑惑可以回復(fù)我~

還有第九、第十行的命名空間錯(cuò)了,‘a(chǎn)pp\Controllers\Driver’,'app\Controllers\ManDriver'改成‘a(chǎn)pp\controllers\Driver',‘a(chǎn)pp\controllers\ManDriver'(都是小寫)

0 回復(fù) 有任何疑惑可以回復(fù)我~

第二行錯(cuò)了,改成use yii\web\Controller;

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Yii框架不得不說的故事—擴(kuò)展篇(4)
  • 參與學(xué)習(xí)       16181    人
  • 解答問題       36    個(gè)

本課程主要學(xué)習(xí)模塊、事件機(jī)制、mixin以及依賴注入技術(shù)

進(jìn)入課程

老師能幫下我嗎

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)