yii2
邱儿
这个作者很懒,什么都没留下…
展开
-
memcache初步认识(文稿)
1.认识memcache,要将它与mysql联系起来,可以把它理解为原创 2014-11-21 14:11:22 · 664 阅读 · 0 评论 -
YII2 电话号码的验证规则
如果你的用户注册使用电话号码的话,那下面的验证是最适合不过的了。 ['mobile', 'number'], ['mobile', 'string', 'min' => 11], ['mobile', 'filter', 'filter' => 'trim'], ['mobile', 'unique', 'targetClass' => '\common\models\User', '原创 2015-04-17 14:21:41 · 6795 阅读 · 2 评论 -
YII2使用笔记
YII2使用笔记1、$model->load() will ignore those not in the rules of the model.原创 2017-08-17 15:31:02 · 197 阅读 · 0 评论 -
YII 创建从后台到前台的链接配置
后台配置文件中添加:'components' => [ 'urlManager' => [ // here is your normal backend url manager config ], 'urlManagerFrontend' => [ // here is your frontend URL原创 2015-04-09 11:08:50 · 2117 阅读 · 0 评论 -
YII2与Bootstrap
今天突然发现用Bootstrap 中的导航组件写的功能没效果了,查看原理是没有加载到bootstrap.js文件,添加depends就好了。<?phpnamespace frontend\assets;use yii\web\AssetBundle;class AppAsset extends AssetBundle{ public $basePath = '@webroot';原创 2015-03-27 14:38:56 · 1872 阅读 · 0 评论 -
Yii中ajax提交注意事项
1 Yii中为了防止csrf攻击,封装了CSRF令牌。csrf都是由Yii::$app->request处理的。1.1 YII框架安装默认开启了csrf验证,关闭验证的方法如下'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is e原创 2015-01-28 11:25:58 · 992 阅读 · 0 评论 -
yii2 session的使用方法
yii2打开sessionuse yii\web\Session; $session = Yii::$app->session;// check if a session is already openif ($session->isActive) ...// open a session$session->open();// close a session$session-转载 2015-01-16 17:36:06 · 1787 阅读 · 0 评论 -
Yii2中记录log日志的配置和使用方法
日志配置'components' => [ 'log' => [ 'traceLevel' => YII_DEBUG? 3 : 0, 'targets' => [ [ 'class' =>'yii\log\FileTarget', 'levels' =>原创 2015-01-16 17:50:02 · 6677 阅读 · 0 评论 -
在model中递归调用model本身时的死循环问题。
我在model自定义中验证中,进行了数据更新操作$model->update();而updata时会引起验证,这样就导致了死循环。报错为:“Fatal error: Maximum function nesting level of '100' reached, aborting”。还好同事给我指出了问题关键,要不然我又会根据网上的方法走偏。原创 2014-12-16 17:41:36 · 770 阅读 · 1 评论 -
数据导出CSV
public function actionSummaryExport(){ $post = \Yii::$app->request->post(); $model = new Model(); $model->load($post, ''); $list = $model->search(); ...原创 2019-05-09 15:31:12 · 218 阅读 · 0 评论