2
我有以下字段: $this->Form->input('vlog_in', array('timeFormat' => '24'));
是否可以在CakePHP时间输入中显示秒数?
这是在数据库中的“时间”字段中,所以它的格式,如输入:00:00(时:分)。
如何显示秒选择框,以便我的用户可以选择它像00:00:00(小时:分钟:秒)?
我有以下字段: $this->Form->input('vlog_in', array('timeFormat' => '24'));
是否可以在CakePHP时间输入中显示秒数?
这是在数据库中的“时间”字段中,所以它的格式,如输入:00:00(时:分)。
如何显示秒选择框,以便我的用户可以选择它像00:00:00(小时:分钟:秒)?
只需构建表格,然后将其拼接在控制器中。我知道,并不像只有一个设置那样漂亮,但...
// VIEW
echo $this->Form->input('vlog_in_hours', array('type' => 'select',
'options' => array_combine(range(0,23), range(0,23)),
));
echo $this->Form->input('vlog_in_minutes', array('type' => 'select',
'options' => array_combine(range(0,59), range(0,59)),
));
echo $this->Form->input('vlog_in_seconds', array('type' => 'select',
'options' => array_combine(range(0,59), range(0,59)),
));
//CONTROLLER
function whatever() {
//...
$data = $this->request->data['MyModel'];
$time = $data['vlog_in_hours'].':'.$data['vlog_in_minutes'].':'.$data['vlog_in_seconds'];
$this->request->data['MyModel']['vlog_in'] = $time;
//...
$this->MyModel->save($this->request->data);
//...
}