#yii

YII服务定位器依赖注入

<?php/***CreatedbyPhpStorm.*Date:2016/5/25*Time:18:33*服务定位器依赖注入*/namespacefrontendcontrollers;useyii;useyiiwebController;useyiidiContainer;useyiidiServiceLoc...

YII容器类依赖注入

程序=算法+数据结构数据结构制约了算法的===>>>>依赖注入依赖注入也就是解数据结构和算法耦合的思想<?php/***CreatedbyPhpStorm.*Date:2016/5/25*Time:18:09*容器类依赖注入*/namespacefrontendcontrollers;us...
代码星球 ·2020-04-10

YII类的映射表机制

<?php/***CreatedbyPhpStorm.*Date:2016/5/25*Time:19:09**YII的类的映射表*/namespacefrontendcontrollers;useYii;useyiiwebController;//usefrontendmodelsPost;//作用被下面的cla...
代码星球 ·2020-04-10

YII http缓存

http禁止缓存原理header('Expires:0');header('Last-Modified:'.gmdate('D,dMYH:i:s').'GMT');header('Cache-Control:no-store,no-cahe,must-revalidate');//ie专用header('Cache-C...
代码星球 ·2020-04-10

YII页面缓存

IndexController.phpnamespacefrontendcontrollers;useyii;useyiiwebController;classIndexControllerextendsController{publicfunctionbehaviors()//先于action执行,可以用来实现页面缓...
代码星球 ·2020-04-10

YII缓存操作

//文件依赖$dependency=newyiicachingFileDependency(['filename'=>'hw.txt'])};$cache->add("file_key",'helloworld',3000,$dependency);//$dependency决定了当缓存文件发生修改时也会失...
代码星球 ·2020-04-10

YII的延迟加载

类的映射表useappmodelorderYii::$classMap['appmodelsOrder']="D:wampwww...modelsOrder.php";//加快查询速度组件延迟加载主要用法Yii::$app->request;到这里才用到__get()去加载 ...
代码星球 ·2020-04-10

YII的lazy loading

版本1require('classclass1.php');require('classclass1.php');if($is_girl){echo'thisisagirl';$class1=newClass1;}else{echo"thisisaboy";$class2=newClass2;}版本2if($is_gi...
代码星球 ·2020-04-10

YII关联查询

 以customerorder两个表为例//关联查询控制器中$customer=Customer::find()->where('name'=>'zhangsan')->one();$orders=$customer->hasmany('orders',['customer_id']=...
代码星球 ·2020-04-10

YII总结学习7(在一个视图中显示另外一个视图)

controllerhello<?phpnamespaceappcontrollers;useyiiwebController;classhelloControllerextendsController{publicfunctionactionIndex(){return$this->renderParti...

YII学习总结6(模板替换和“拼合”)

controllerhelloController.php<?phpnamespaceappcontrollers;useyiiwebController;classhelloControllerextendsController{public$layout="common";publicfunctionacti...

YII学习总结5(视图)

<?phpnamespaceappcontrollers;useyiiwebController;classHelloControllerextendsController{publicfunctionactionIndex(){$hellp_str="helloGod!";$data=array();$data...
代码星球 ·2020-04-10

YII学习总结4(cookie操作)

cookie操作<?phpnamespaceappcontrollers;useyiiwebController;useyiiwebCookie;classHelloControllerextendsController{//存入cookie和修改cookie$cookies=YII::$app->resp...

YII学习总结3(session)

session操作<?phpnamespaceappcontrollers;useyiiwebController;classHelloControllerextendsController{    publicfunctionactionIndex(){  //把session当做对象  $session=yi...
代码星球 ·2020-04-10

YII学习总结2(命名空间和操作响应)

YII基础准备1.命名空间<?php/****假设有三个同名的类,输出的值为A,B,C****/useacapple;usedefappleasbApple;useghiapple;$app=newapple();//A$app=newbApple();//B$app=newApple();//C调用的是全局的...
首页上一页...678910下一页尾页