飒雅

飒雅

急流勇退,谓之知机

  • 财富值5
  • 威望值0
  • 总积分115

个人信息

  • 回复了 的回答

    在视图文件中:
    ``<?php

    use app\modules\member\components\ModuleAsset;

    / @var $this yii\web\View /

    $assets = ModuleAsset::register($this);

    $this->title = '';

    $this->registerCssFile($assets->baseUrl . '/css/cart/index.css', ['depends' => [ModuleAsset::className()]]);
    $this->registerJsFile($assets->baseUrl . '/js/cart/index.js', ['depends' => [ModuleAsset::className()]]);
    ?>`

    可以加载assets文件夹下的不同js和css
    

    第一个好好的,第二个就开始乱串.

  • 2016-08-03 已签到
    连续签到2天,获得了10个金钱
  • 提出了问题
    Css and Js资源加载
  • 2016-08-02 已签到
    连续签到1天,获得了5个金钱
  • 回复了 的回答
    $model = new User();
    foreach($data as $attributes)
    {
         $_model = clone $model;
         $_model->setAttributes($attributes);
         $_model->save();
    }
    
    Yii::$app->db->createCommand()->batchInsert(UserModel::tableName(), ['user_id','username'], [
        ['1','test1'],
        ['2','test2'],
        ['3','test3'],   
    ])->execute();
    

    没有崩哦.顺利执行了.刷新一次就是40条.

  • 关注了
  • 关注了
  • 回复了 的回答
    $model = new User();
    foreach($data as $attributes)
    {
         $_model = clone $model;
         $_model->setAttributes($attributes);
         $_model->save();
    }
    
    Yii::$app->db->createCommand()->batchInsert(UserModel::tableName(), ['user_id','username'], [
        ['1','test1'],
        ['2','test2'],
        ['3','test3'],   
    ])->execute();
    

    我想要一个随机码要怎么写呢?这个方法很强势.我试过了,可以滴

  • 回复了 的回答
    $model = new User();
    foreach($data as $attributes)
    {
         $_model = clone $model;
         $_model->setAttributes($attributes);
         $_model->save();
    }
    
    Yii::$app->db->createCommand()->batchInsert(UserModel::tableName(), ['user_id','username'], [
        ['1','test1'],
        ['2','test2'],
        ['3','test3'],   
    ])->execute();
    

    我试试昂.

  • 回复了 的回答

    批量插入数据,还是已经有数据了,直接导入?

    你好,是没有数据,自己要写的,

助理 等级规则
115/200
资料完整度
100/100
用户活跃度
0/100

Ta的关注

2

Ta的粉丝

6

Ta的访客

10