方法
public function index()
{
$ad = Destoon_ad::get(2);
return $ad->totime;
}
模型下创建读取器
protected function getTotimeAttr($totime){
return date('Y-m-d',$totime);
}
加入第二个参数data
protected function getTotimeAttr($totime,$data){
return $data['title'].'|'.date('Y-m-d',$totime);
}
public function index()
{
$ad = new Ad;
$ad->pid = '999';
$ad->url = 'www.999.com';
if($ad->save()){
return $ad->aid;
}
}
模型下创建 修改器
protected function setTotimeAttr($totime){
return strtotime($totime);
}