摘要: //文件依赖 $dependency = new \yii\caching\FileDependency(['filename'=>'hw.txt'])}; $cache->add("file_key",'hello world',3000,$dependency);//$dependency决定了当缓存文件发生修改时也会失效 //表达式的依赖 $dependency = new... 阅读全文
posted @ 2016-05-19 21:17 雨落知音 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 类的映射表 组件延迟加载 阅读全文
posted @ 2016-05-19 21:10 雨落知音 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 版本1 require('class\class1.php'); require('class\class1.php'); if($is_girl){ echo 'this is a girl'; $class1 = new Class1; }else{ echo "this is a boy"; $class2 = new Class2; } 版本2 if... 阅读全文
posted @ 2016-05-19 20:57 雨落知音 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 以customer order两个表为例 //关联查询控制器中 $customer = Customer::find()->where('name'=>'zhangsan')->one(); $orders = $customer->hasmany('orders',['customer_id']=>'id')->asArray()->all(); $orders = $customer->... 阅读全文
posted @ 2016-05-19 20:41 雨落知音 阅读(285) 评论(0) 推荐(0) 编辑