有些人觉得看不懂,对于初学者来说,的确理解起来很吃力,毕竟这些是中级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