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

浙公网安备 33010602011771号