1. If a form token is added, the name of the form is consistent with the corresponding model field, otherwise the token of the pit daddy is wrong.
2. If a form token is added,create can only use the defaultPOST数据创建数据对象,不然又是坑爹的令牌错误。
The second parameter of the 3.create method specifies the state of the operation that creates the data, which is automatically determined by default as a write or update operation.
You can also explicitly specify an operation state, for example:
$Member = M("User");
// 指定更新数据操作状态
$Member->create($_POST,Model::MODEL_UPDATE);
The system built-in data operations include Model::MODEL_INSERT (or 1) and Model::MODEL_UPDATE (or 2), when not specified, the system according to whether the data source contains primary key data to automatically determine, if there is primary key data, as the Model::MODEL_UPDATE operation.
thinkphp Automatic Validation related notes