随笔分类 -  YII框架

摘要:Yii 查询 find 条件不等于null or 不能等空$postware = Postware::find()->select(['house_num'])->where(['account_id' => $account_id, 'send_way' => 4])->andFilterWher 阅读全文
posted @ 2020-11-25 15:25 没事就更 阅读(1423) 评论(0) 推荐(0)
摘要:$query = new Query();$query->select('gs.*, g.goods_images, sa.attr_name, sa.is_default, sa.alias_sort')->from(GoodsSpec::tableName() . ' gs');$query-> 阅读全文
posted @ 2020-09-07 14:20 没事就更 阅读(702) 评论(0) 推荐(0)
摘要:1、创建api应用入口 阅读全文
posted @ 2020-05-14 00:04 没事就更 阅读(212) 评论(0) 推荐(0)
摘要:1、缓存依赖 2、片段缓存 3、页面缓存 4、HTTP缓存 阅读全文
posted @ 2020-05-06 15:15 没事就更 阅读(128) 评论(0) 推荐(0)
摘要:3、缓存键 阅读全文
posted @ 2020-05-06 10:48 没事就更 阅读(121) 评论(0) 推荐(0)
摘要:1、去掉入口文件 2、路由和参数美化 'urlManager' => [ 'enablePrettyUrl' => true, // 是否美化路由 'showScriptName' => false, //是否展示脚本文件 'suffix' => '.gx', //伪静态 'rules' => [ 阅读全文
posted @ 2020-05-06 10:00 没事就更 阅读(236) 评论(0) 推荐(0)
摘要:1、命令带参数 2、定时任务脚本例子 <?php namespace console\controllers; use common\models\Postware; /** * 定时关闭订单任务脚本 * Class SemihCloseOrderController * @package cons 阅读全文
posted @ 2020-04-28 14:33 没事就更 阅读(373) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-04-26 17:30 没事就更 阅读(108) 评论(0) 推荐(0)
摘要:Yii::$app->urlManager->createUrl( ['post/detail', 'id'=>$this->id, 'title'=>$this->title]); 阅读全文
posted @ 2020-04-26 17:15 没事就更 阅读(604) 评论(0) 推荐(0)
摘要:1、 2、 阅读全文
posted @ 2020-04-26 16:45 没事就更 阅读(139) 评论(0) 推荐(0)
摘要:1、用户只能在10.31号当天访问这个页面 class PostController extends Controller { /** * @inheritdoc */ public function behaviors() { return [ 'verbs' => [ 'class' => Ve 阅读全文
posted @ 2020-04-26 16:07 没事就更 阅读(157) 评论(0) 推荐(0)
摘要:1、认证 1.1 用户组件 2、前后台分离 2.6 <?php$params = array_merge( require(__DIR__ . '/../../common/config/params.php'), require(__DIR__ . '/../../common/config/pa 阅读全文
posted @ 2020-04-22 14:56 没事就更 阅读(260) 评论(0) 推荐(0)
摘要:表model类中 //Getter方法 处理content字段 public function getContentText(){ $tmp = strip_tags($this->content); $temLen = mb_strlen($tmp); return mb_substr($tmp, 阅读全文
posted @ 2020-04-21 16:06 没事就更 阅读(268) 评论(0) 推荐(0)
摘要:1、数据提供者DataProvider,如用在modelsearch类中 <?php namespace common\models; use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; use common\models\Po 阅读全文
posted @ 2020-04-19 01:53 没事就更 阅读(1120) 评论(0) 推荐(0)
摘要:1、小部件 DetailView 用在显示一条记录详情 2、ActiveForm 3、GridView数据小部件 4、ActionColumn 动作列的配置属性 阅读全文
posted @ 2020-04-19 01:47 没事就更 阅读(326) 评论(0) 推荐(0)
摘要:创建QueryBuilder 阅读全文
posted @ 2020-04-18 23:09 没事就更 阅读(238) 评论(0) 推荐(0)
摘要:1、HTML助手类 2、Array Helper助手类 阅读全文
posted @ 2020-04-18 22:40 没事就更 阅读(194) 评论(0) 推荐(0)
摘要:1、数据关联查询时 hasOne和hasMany 如果数据表设计时有关联关系 gii会自动生成以下关联方法。 设计表时没有关联也没关系,可以自己来写关联方法。 其中方法getStatus0 就是通过表的关联关系 自动生成的,为什么方法会带个0呢,是因为post表中带有status这个字段属性,避免冲 阅读全文
posted @ 2020-04-18 12:49 没事就更 阅读(246) 评论(0) 推荐(0)
摘要:1、什么是ActiveRecord 2、声明AR类 3、 操作CRUD public function getPoststatus(){ $poststatus = Poststatus::find()->select(['name', 'id'])->indexBy('id')->column() 阅读全文
posted @ 2020-04-18 12:08 没事就更 阅读(217) 评论(0) 推荐(0)
摘要:1、连接数据库 2、使用数据库 3、数据库查询总结 阅读全文
posted @ 2020-04-17 16:57 没事就更 阅读(356) 评论(0) 推荐(0)