摘要:AdminLTE2.4.18 bootstrap3 左侧菜单高亮 //菜单 $(function(){ console.log('eeeeeeeeee'); $('.sidebar-menu li:not(.treeview) > a').on('click', function(){ var $p
阅读全文
摘要:Yii2 AppAsset.php 和 assetManager 组件 01) 背景:Yii2中使用了 AdminLTE 3.0.0 后框架自带的bootstrap.css 与 admin样式有冲突,需要去掉 bootstrap.css 在 backend/config/main.php 的 com
阅读全文
摘要:Yii2 中发送邮件 yii\swiftmailer\Mailer 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@common/mail', 'useFileTransport' => false, 'trans
阅读全文
摘要:Yii2 中间关联表 via() viaTable()viaTable() /** * @link https://www.yiiframework.com/doc/guide/2.0/zh-cn/db-active-record#junction-table * user 表 id * book_
阅读全文
摘要:1. 前端资源, Yii2 前端资源管理 'components' => [ 'assetManager' => [//资源管理 'bundles' => [ 'yii\bootstrap\BootstrapAsset' => false,//禁用 Twitter Bootstrap 框架的 CSS
阅读全文
摘要:Yii2 layout 由 controller 向layout中传递参数值 // controller public function actionIndex() { Yii::$app->view->params['model'] = "hello world"; return $this->r
阅读全文
摘要:Yii2 中 checkboxlist 复选框 默认选中问题 方法1: 在 controller 中 model->字段 = 值; 比如: $model->type= 1; 方法2: <?= $form->field($model, 'type')->checkboxlist([ 1 => 'ite
阅读全文
摘要:出现问题 Call to undefined function yii\\helpers\\mb_strlen() "data": { "name": "Exception", "message": "Call to undefined function yii\\helpers\\mb_strle
阅读全文
摘要:Yii2 搜索条件,使用gii创建搜索模型 <?php namespace app\models; use Yii; use yii\base\Model; use yii\data\ActiveDataProvider; class PostSearch extends Post { public
阅读全文
摘要:Yii::trace():记录一条消息去跟踪一段代码是怎样运行的。这主要在开发的时候使用。 Yii::info():记录一条消息来传达一些有用的信息。 Yii::warning():记录一个警告消息用来指示一些已经发生的意外。 Yii::error():记录一个致命的错误,这个错误应该尽快被检查 1
阅读全文
摘要:Yii2.0 rules验证规则大全 required : 必须值验证属性 [['字段名'],required,'requiredValue'=>'必填值','message'=>'提示信息']; #说明:CRequiredValidator 的别名, 确保了特性不为空 指定场景 [['title'
阅读全文
摘要:Yii2 where使用 Yii2 查询运算符 // 运算符有 // and、or、not、 // between、not between、 // in、not in、 // like、or like、not like、or not like、 // exists、not exists、 // >、
阅读全文
摘要:yii2 behaviors 1、使用控制过滤器, return [ 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true, 'actions' => ['index'], 'roles
阅读全文
摘要:如果你有一些静态页面,并且不会经常修改他们,那么不值得查询数据库,并为他们做页面管理。 工作原理: 我们连接了外部动作,名叫\yii\web\ViewAction,它只是尝试去找到一个视图,和$_GET参数提供的名称一致。如果找到了, 展示它。如果找不到,将会给一个404 not found的页面。
阅读全文
摘要:yii2 手动安装第三方扩展 1、不使用composer,有autoloader 在入口文件index.php中有两个自动加载,一个是自己的一个值composer的: require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ .
阅读全文
摘要:1、语言设置 return [ 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'vendorPath' => dirname(dirname(__DIR__)) . '/vend
阅读全文
摘要:1). Yii2 view 层显示值 [ 'attribute'=>'字段名', 'format' => 'raw', 'value'=> call_user_func(function ($model){ $img_url = "图片路径"; return Html::a( Html::img($
阅读全文
摘要:!!!!本文排版错乱,请到新地址; 点击到新地址 Yii2.0 rules验证规则大全 required : 必须值验证属性 [['字段名'],required,'requiredValue'=>'必填值','message'=>'提示信息']; #说明:CRequiredValidator 的别名
阅读全文
摘要:<?= $form->field($model, 'sex')->checkboxList([0 => '男', 1 => '女', 2 => '保密'], ['value' => [0, 1], 'item' => function ($index, $label, $name, $checked
阅读全文