0
我正在使用最新的穩定版本,如果必須更新版本5,請告訴我。RedBeanPHP:如何添加時間戳,唯一和默認?
<?php
$user = R::dispense('user');
$user->fname = 'man';
$user->lname = '00';
$user->setMeta("buildcommand.unique" , array($user->email='[email protected]'));
$user->pass = password_hash('password', PASSWORD_DEFAULT);
$user->gender=0; // I want this to have a default value of 0 if I don't insert anything
$user->verified=1;
$user->lastModified = date('Y-m-d G:i:s'); // I want this to be a timestamp, right now it's stored as datetime
$id= R::store($user);
lastModified
被存儲爲日期時間。我希望gender
和verified
的默認值爲0.我希望email
是唯一的。
我想盡解決方案,我可以在計算器並沒有什麼發現作品
$user->setMeta("buildcommand.unique" , array(array('email')));
,以及如何創建BLOB和如何指定字段的長度?