![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
php-yii2
飞_持续更新在cnblogs
这个作者很懒,什么都没留下…
展开
-
windows安装composer方法和使用方法
转载;: http://www.cnblogs.com/lookphp/p/b15af85f67dc7df59a970d905713262a.htmlwindows安装composer方法和使用方法,安装完成并测试monolog转载 2017-06-26 12:50:48 · 339 阅读 · 0 评论 -
yii2 config_02
1. 前端资源, Yii2 前端资源管理'components' => [ 'assetManager' => [//资源管理 'bundles' => [ 'yii\bootstrap\BootstrapAsset' => false,//禁用 Twitter Bootstrap 框架的 CSS 文件 ...原创 2018-12-13 10:21:19 · 328 阅读 · 0 评论 -
Yii2 layout 由 controller 向layout中传递参数值
// controller public function actionIndex() { Yii::$app->view->params['model'] = "hello world"; return $this->render('index'); }//layout main.php$model =...原创 2018-11-25 14:23:55 · 575 阅读 · 0 评论 -
Yii2 中 checkboxlist 复选框 默认选中
Yii2 checkboxlist 选中问题方法1: 在 controller 中 model->字段 = 值; 比如: $model->type= 1;方法2: <?= $form->field($model, 'type')->checkboxlist([ 1 => 'item 1'...原创 2018-11-24 22:03:35 · 1453 阅读 · 0 评论 -
Yii2 search 搜索[数据小部件--GridView--数据过滤]
Yii2 搜索条件,使用gii创建搜索模型<?phpnamespace app\models;use Yii;use yii\base\Model;use yii\data\ActiveDataProvider;class PostSearch extends Post{ public function rules() { // 只有在...原创 2018-11-05 16:54:26 · 2056 阅读 · 0 评论 -
centos PHP7 yii2 报错 Call to undefined function yii\\helpers\\mb_strlen()
出现问题 Call to undefined function yii\\helpers\\mb_strlen() "data": { "name": "Exception", "message": "Call to undefined function yii\\helpers\\mb_strlen()", "code":原创 2018-11-06 16:33:14 · 1810 阅读 · 0 评论 -
Yii2 log 模块,消息日志
Yii::trace():记录一条消息去跟踪一段代码是怎样运行的。这主要在开发的时候使用。Yii::info():记录一条消息来传达一些有用的信息。Yii::warning():记录一个警告消息用来指示一些已经发生的意外。Yii::error():记录一个致命的错误,这个错误应该尽快被检查1). 配置//common/config/main.php 配置'component...原创 2018-10-25 16:29:21 · 1395 阅读 · 0 评论 -
Yii2 where使用
Yii2 查询运算符 // 运算符有 // and、or、not、 // between、not between、 // in、not in、 // like、or like、not like、or not like、 // exists、not exists、 // >...原创 2018-10-09 21:00:42 · 1223 阅读 · 1 评论 -
Yii2.0 rules验证规则大全
Yii2.0 rules验证规则大全required : 必须值验证属性[['字段名'],required,'requiredValue'=&amp;amp;amp;amp;amp;gt;'必填值','message'=&amp;amp;amp;amp;amp;gt;'提示信息']; #说明:CRequiredValidator 的别名, 确保了特性不为空.指定场景[['title', 'content'], 'required', 'on' =&原创 2018-10-15 18:04:15 · 482 阅读 · 0 评论 -
yii2中的checkboxList
$form->field($model, 'sex')->checkboxList([0 => '男', 1 => '女', 2 => '保密'], [ 'value' => [0, 1], 'item' => function ($index, $label, $name, $checked, $value) { $checkStr = $checked ? "check转载 2017-05-21 01:13:12 · 1585 阅读 · 0 评论 -
yii2 config
1、语言设置return [ 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', ...原创 2017-12-12 09:50:24 · 698 阅读 · 0 评论 -
yii2 behaviors
1、使用控制过滤器, return [ 'access' => [ 'class' => AccessControl::className(), 'rules' => [ [ 'allow' => true原创 2017-12-22 16:03:26 · 333 阅读 · 0 评论 -
Yii2 view 层显示值
1). Yii2 view 层显示值[ 'attribute'=>'字段名', 'format' => 'raw', 'value'=> call_user_func(function ($model){ $img_url = "图片路径"; return Html::a( Html::img(...原创 2017-12-05 18:14:13 · 717 阅读 · 0 评论 -
yii2 展示静态页面
如果你有一些静态页面,并且不会经常修改他们,那么不值得查询数据库,并为他们做页面管理。工作原理:我们连接了外部动作,名叫\yii\web\ViewAction,它只是尝试去找到一个视图,和$_GET参数提供的名称一致。如果找到了,展示它。如果找不到,将会给一个404 not found的页面。如果没有设置viewParam,将会使用默认值defaultView。原创 2017-12-21 15:13:10 · 1265 阅读 · 0 评论 -
yii2 手动安装第三方扩展
1、不使用composer,有autoloader在入口文件index.php中有两个自动加载,一个是自己的一个值composer的:require __DIR__ . '/../../vendor/autoload.php';require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';添加你需要的autoloader:requi原创 2017-12-20 13:56:35 · 4369 阅读 · 0 评论 -
Yii2.0 rules验证规则大全
!!!!本文排版错乱,请到新地址; 点击到新地址Yii2.0 rules验证规则大全required : 必须值验证属性[['字段名'],required,'requiredValue'=>'必填值','message'=>'提示信息']; #说明:CRequiredValidator 的别名, 确保了特性不为空.[['字段名'],required,'requiredVa...转载 2017-05-22 21:57:08 · 443 阅读 · 0 评论 -
yii2 中间关联表 via() viaTable()
viaTable() /** * @link https://www.yiiframework.com/doc/guide/2.0/zh-cn/db-active-record#junction-table * user 表 id * book_user 表 user_id book_id * book 表 id * * ...原创 2018-12-18 12:11:06 · 3060 阅读 · 0 评论