Joke Collection Website - Blessing messages - Yii2 Why does storing data in an array lead to setting unknown properties?

Yii2 Why does storing data in an array lead to setting unknown properties?

When using Yii2 framework, if the query data is stored in an array, you want to add a new subscript to the array. If the new subscript name does not exist in the data table field used by the model, an error will be issued as shown in the title.

Solve:

Method 1: define variables with subscript names in the model;

Method 2: When fetching data, use asArray () to save the result as a pure array.