thinkphp5 modifier

Action modifier may be made automatically at the time of data conversion processing assignment

class User extends Model 
{
    public function setNameAttr($value) { return strtolower($value); } }

In addition to assignments of the modifier can be triggered, the batch can be modified

$user = new User(); $data['name'] = 'THINKPHP'; $data['email'] = '[email protected]'; $user->data($data, true); $user->save(); echo $user->name;

Guess you like

Origin www.cnblogs.com/CWJDD/p/11459143.html