How to get the field values just generated in the model when using the Thinkphp model auto-completion.
// 自动完成protected $_auto = array( array('rand', 'random', self::MODEL_INSERT, 'function'), // 插入的时候生成随机数 array('password', 'encrypt', self::MODEL_INSERT, 'callback'), array('login', 'time', 3, 'function'), // 对login字段在更新的时候写入当前时间戳 array('ip', 'get_client_ip', 3, 'function') , // 对ip字段在更新的时候自动获取ip地址);function encrypt($data){ // 此处怎么才能调用 rand 这个随机数 echo 'rand的随机数';}
Please ask the great God for your doubts. Kneeling thanks.
Reply content:
How to get the field values just generated in the model when using the Thinkphp model auto-completion.
// 自动完成protected $_auto = array( array('rand', 'random', self::MODEL_INSERT, 'function'), // 插入的时候生成随机数 array('password', 'encrypt', self::MODEL_INSERT, 'callback'), array('login', 'time', 3, 'function'), // 对login字段在更新的时候写入当前时间戳 array('ip', 'get_client_ip', 3, 'function') , // 对ip字段在更新的时候自动获取ip地址);function encrypt($data){ // 此处怎么才能调用 rand 这个随机数 echo 'rand的随机数';}
Please ask the great God for your doubts. Kneeling thanks.
Object-oriented:
$User = D("User"); // 实例化User对象$User->create(); // 生成数据对象echo $User->rand;//获取rand
I('post.rand')呢,,有没有试过?