• Yii2.0 framework database operation simple example [add, modify, delete, query, print, etc.]


    This paper describes the yii2.0 framework database operation with an example. The details are as follows: add to $id = \Yii::$app->db ->createCommand() ->Insert (‘table name ‘, [‘car_ num’ => $car_ num, ‘lg_ shop_ id’ => $shop_ id]) ->execute(); Batchinsert(): add multiple rows at a time // table name, column names, column values Yii::$app->db->createCommand()->batchInsert(‘user’, [‘name’, ‘age’], […]

  • Yii2.0 framework to upload Excel files and import them into the database


    In this paper, an example of yii2.0 framework to upload Excel files into the database after the method. The details are as follows: Model model <?php /** *Describe * @author zcy * @date 2019/8/13 */ namespace app\models; use yii\base\Model; use yii\db\ActiveRecord; use yii\web\UploadedFile; class uploadForm extends ActiveRecord { public $file; public function rules() { return […]

  • Yii2.0 framework multi model operation example [add / modify / delete]


    In this paper, an example is given to illustrate the multi model operation of yii2.0 framework. The details are as follows: controller: <?php namespace app\controllers; use Yii; use yii\web\Controller; use yii\base\Model; use app\models\shopUsers; use app\models\shopLeagueInfo; use yii\web\NotAcceptableHttpException; class UserController extends Controller { public $layout = ‘shopUser’; public function actionSave($id) { $user = shopUsers::find()->where([‘id’ => $id])->one(); […]

  • Yii 2.0 RESTful API Basic Configuration Tutorial


    Recently, I have been working on Yii2.0 RESTful API function. After searching for a long time, I found this kind of tutorial. Thank the author, the following contents have been modified according to the actual situation of my project. Install yii2.0 After installing Composer, you can install the Yii application template by running the following […]