yii2之学习笔记

时间:2023-01-30 21:37:30

如下内容为平时学的时候搜集内容,比较碎,现打包送上。希望能给学习yii2朋友些许帮助。
引入第三方库 composer
http://www.yiichina.com/doc/guide/2.0/tutorial-yii-integration

布局
不带布局

return $this->renderPartial('index');

带布局

return $this->render('index');

js 、css方面
实例

//只在该视图中使用非全局的jui
use backend\assets\AppAsset;
AppAsset::addScript($this,'@web/static/js/search.kw.js');
AppAsset::addCss($this,'@web/static/css/search.kw.css');
$js = <<<js
alert("asdf");
js;

$this->registerJs($js);
$css = <<<css
.search{

}

css;

$this->registerCss($css);

参考资料
http://www.yii-china.com/post/detail/39.html

http://blog.csdn.net/sofia1217/article/details/41849555

http://www.yiichina.com/tutorial/399

http://www.yiichina.com/tutorial/411

数据库操作
参考资料
http://blog.csdn.net/lxg2015/article/details/48573377#t0

http://www.yiichina.com/tutorial/834

https://getyii.com/topic/219

MODEL 写法

https://segmentfault.com/a/1190000004279639

Yii2的urlManager URL美化
http://www.cnblogs.com/dcb3688/p/4607968.html

权限控制RBAC
http://www.manks.top/yii2-frame-rbac-template.html

http://blog.csdn.net/woshihaiyong168/article/details/53115317

yii2.0 Activeform表单部分组件使用方法 [ 2.0 版本 ]

http://www.yiichina.com/tutorial/341

http://www.yii-china.com/post/detail/297.html

http://blog.csdn.net/qq_31648761/article/details/73274348

获取来源页面地址
http://www.kkh86.com/it/yii2-adv/guide-mistake-get-referer.html
时间
https://github.com/yiisoft/yii2/blob/master/docs/guide-zh-CN/output-formatting.md

http://www.xuenb.com/web/148603101759644.html

分页
https://segmentfault.com/a/1190000003765846

https://hisune.com/view/28/yii2-gridview-grid-per-page-select

gridview 定义 操作按钮

http://www.cnblogs.com/52cik/p/yii2-ActionColumn.html

http://www.yiichina.com/tutorial/115

http://blog.csdn.net/u012979009/article/details/51752693
Html 类的 dropDownList方法
http://www.111cn.net/phper/php-mb/72865.htm

http://www.yiichina.com/tutorial/826

Yii 2表单widget的使用示例
https://blog.tanteng.me/2015/10/yii2-form-widget/

https://blog.tanteng.me/2015/10/yii2-widget/

session or cookies
http://www.yiichina.com/tutorial/840

http://www.cnblogs.com/chenhaoyu/p/5951969.html

全局变量
http://www.lai18.com/content/1954608.html?from=cancel

Yii中的页面跳转与传值

$this->redirect(array('跳转到的controller/跳转到的controller里的action','参数'=>'值',,,,)); 

$this->redirect(array('user/getuser','id'=>1));
$this->render('view页面',array('参数'=>'值')); 

$this->render('news',array('result'=>'123','result1'=>'456')); 

url重定向   $this->redirect(array('action方法')); 

$this->redirect(array('getnews','id'=>1,,,,)); 

多目录
http://blog.csdn.net/lhorse003/article/details/70245747

http://blog.csdn.net/meegomeego/article/details/40182867

api
https://getyii.com/topic/28

http://www.yii-china.com/post/detail/440.html

http://www.cnblogs.com/ganiks/p/Yii2-RESTful-Authentication-and-Authorization.html

http://blog.csdn.net/daxia_85/article/details/50603587

http://www.xiaoxiangzi.com/Programme/PHP/3348.html

yii2-fast-api 快速配置并开发基于 yii2 的 api 服务
http://www.yiichina.com/extension/1161
Yii2框架制作RESTful风格的API快速入门教程

http://www.jb51.net/article/96824.htm

Yii2 RESTful中api的使用及开发实例详解

https://www.52jbj.com/jbdq/511207.html

日志
实例
配置文件

[
    'class' => 'yii\log\FileTarget',
    'levels' => ['info'],
    'categories' => ['rhythmk'],
   // 'logVars' => ['_SERVER'], //控制日志输出参数
    'logFile' => '@app/runtime/logs/Mylog/requests.log',
    'maxFileSize' => 1024 * 2,
    'maxLogFiles' => 20,
],

使用

Yii::info("info okl","rhythmk");

http://www.cnblogs.com/rhythmK/p/4479246.html

下拉框联动
http://cleanbugs.com/item/yii2-can-be-a-way-to-achieve-the-drop-down-box-linkage-412500.html

http://blog.csdn.net/wjtlht928/article/details/46406857

https://segmentfault.com/a/1190000006792406

跨域

http://www.cnblogs.com/yangbanban/p/5065735.html

支付宝

https://github.com/liulipeng/yii2-alipay

https://github.com/xiaochengfu/yii2-alipay

http://www.yiichina.com/topic/7011

导出 excel

http://www.cnblogs.com/lccjob/p/5919045.html

验证码

http://blog.csdn.net/dc769319/article/details/53022570

http://blog.csdn.net/ljfrocky/article/details/46121501

http://www.yiichina.com/tutorial/1318