奇怪的问题,这样写为什么会报错???

浏览:289 发布日期:2016/06/20 分类:求助交流 关键字: 奇怪的问题
namespace app\index\model;
use think\Model;
class User extends Model
{
//自动完成
protected $insert = [
'regdate' => date("Y-m-d"), //注册日期
'regtime' => date("H:i:s") //注册时间
];
}

执行 报错 syntax error, unexpected '(', expecting ']'

但是这样写就可以
//自动完成
protected $insert = [
'regdate' => '2016-06-20', //注册日期
'regtime' => '14:15:01', //注册时间
];

为什么呢 regdate/regtime 赋值 不能使用函数吗??
要主动填写 regdate/regtime 为当前日期和时间 应该怎么写???
最佳答案
评论( 相关
后面还有条评论,点击查看>>