有些人覺得看不懂,對于初學者來說,的確理解起來很吃力,畢竟這些是中級PHP程序員的知識,已經深入到設計模式和框架架構,最好的有一定框架基礎和項目經驗再來看會比較好,老師所講的這些知識真的很有用
2018-02-14
就是個工廠模式,現在按照視頻的說法,有一個MovieLister的類,這個類中的XXXBy()方法用于查詢喜歡的電影,通過穿入XXXBy()不同的對象參數,查詢出不同類型的電影。就好比這個方法是個工廠,傳進去兒童類,出來兒童電影,傳進去成人類,出來成人的電影。
2018-01-22
最新回答 / 慕無忌7233295
【蜘蛛俠TG@abin789】-3001【蜘蛛俠TG@abin789】-3002【蜘蛛俠TG@abin789】-3003【蜘蛛俠TG@abin789】-3004【蜘蛛俠TG@abin789】-3005【蜘蛛俠TG@abin789】-3006【蜘蛛俠TG@abin789】-3007【蜘蛛俠TG@abin789】-3008【蜘蛛俠TG@abin789】-3009【蜘蛛俠TG@abin789】-3010【蜘蛛俠TG@abin789】-3011【蜘蛛俠TG@abin789】-3012【蜘蛛俠TG@abin789】...
2017-12-01
在config文件里也是直接復制GII generator之后的信息
Default里ECHO “123”;
Hello里
$article = \YII::$app->getModule('article');
$article->runAction('default\index');
Not Found (#404)
Page not found.
The above error occurred while the Web server was processing your request.
Default里ECHO “123”;
Hello里
$article = \YII::$app->getModule('article');
$article->runAction('default\index');
Not Found (#404)
Page not found.
The above error occurred while the Web server was processing your request.
2017-11-21
public function actionSend()
{
$this->on('miao',[$this,'pao']);
$this->mao();
//$this->pao();
}
public function mao()
{
echo '貓再叫:miao....<br>';
$this->trigger('miao');
}
public function pao()
{
echo '大家快跑..<br>';
}
}
{
$this->on('miao',[$this,'pao']);
$this->mao();
//$this->pao();
}
public function mao()
{
echo '貓再叫:miao....<br>';
$this->trigger('miao');
}
public function pao()
{
echo '大家快跑..<br>';
}
}
事件和函數調用差不多吧,只是為了解耦,擴展方便而已吧。舉例說明:
public function actionSend()
{
$this->on('miao',function ($event){
echo '大家快跑,快點跑跑跑...<br>';
});
$this->mao();
}
public function mao()
{
echo '貓再叫:miao....<br>';
$this->trigger('miao');
}
public function actionSend()
{
$this->on('miao',function ($event){
echo '大家快跑,快點跑跑跑...<br>';
});
$this->mao();
}
public function mao()
{
echo '貓再叫:miao....<br>';
$this->trigger('miao');
}
2017-10-19
最新回答 / 慕無忌7233295
【蜘蛛俠TG@abin789】-3201【蜘蛛俠TG@abin789】-3202【蜘蛛俠TG@abin789】-3203【蜘蛛俠TG@abin789】-3204【蜘蛛俠TG@abin789】-3205【蜘蛛俠TG@abin789】-3206【蜘蛛俠TG@abin789】-3207【蜘蛛俠TG@abin789】-3208【蜘蛛俠TG@abin789】-3209【蜘蛛俠TG@abin789】-3210【蜘蛛俠TG@abin789】-3211【蜘蛛俠TG@abin789】-3212【蜘蛛俠TG@abin789】...
2017-08-28