<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                > 使用官方提供的yii2-mongodb擴展即可實現 > https://github.com/yiisoft/yii2-mongodb ### 安裝擴展 ~~~ php composer.phar require --prefer-dist yiisoft/yii2-mongodb ~~~ ### 配置mongodb數據庫 > main-local.php ~~~ return [ //.... 'components' => [ 'mongodb' => [ 'class' => '\yii\mongodb\Connection', 'dsn' => 'mongodb://@localhost:27017/mydatabase', 'options' => [ "username" => "Username", "password" => "Password" ] ], ], ]; ~~~ ### 創建 ActiveRecord 模型 ~~~ namespace common\mongomodels; use common\behaviors\DatetimeBehavior; use Yii; use yii\behaviors\TimestampBehavior; /** * SMS日志記錄 * This is the model class for table "sms_log". * * @property \MongoDB\BSON\ObjectID|string $_id * @property string $mobile * @property string $code * @property integer $type * @property integer $created_at * @property integer $updated_at */ class SmsLog extends \yii\mongodb\ActiveRecord { const TYPE_BIND = '1'; //綁定 const TYPE_CHECK_OLD = '2'; //驗證以前的 const TYPE_CHANGE = '3'; //修改 const TYPE_WITHDRAW = '4'; //提現 /** * @inheritdoc */ public static function collectionName() { return ['test', 'sms_log']; } public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), 'createdAtAttribute' => 'created_at', 'updatedAtAttribute' => 'updated_at', ], ]; } /** * @inheritdoc */ public function rules() { return [ [['mobile', 'code', 'type'], 'required'], [['type'], 'string'], [['type'], 'in', 'range' => [self::TYPE_BIND, self::TYPE_CHECK_OLD, self::TYPE_CHANGE, self::TYPE_WITHDRAW]], [['created_at', 'updated_at'], 'safe'], [['mobile', 'code'], 'string', 'max' => 50], ]; } /** * @inheritdoc */ public function attributes() { return [ '_id', 'mobile', 'code', 'type', 'created_at', 'updated_at', ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'mobile' => '手機號', 'code' => '驗證碼', 'type' => '類型', 'created_at' => '創建時間', 'updated_at' => '更新時間', ]; } } ~~~ ### 使用 ActiveRecord CRUD 例子 ~~~ $smslog = SmsLog::findOne(['mobile' => $mobile, 'type' => SmsLog::TYPE_BIND]); $smslog->mobile = 'xxx'; $smslog->save(); ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看