public function hitsaction() {	    $id   = (int)$this->get('id');		if (empty($id))	exit;		$data = $this->db->settablename('content')->find($id, 'hits');		$hits = $data['hits'] + 1;		$this->db->settablename('content')->update(array('hits'=>$hits), 'id=?' , $id);		echo document.write('$hits');;	}
这个是我网上下载的一个cms程序的一段控制文章阅读量的代码,我想在这段代码里面加上刷新或访问后,文章的时间字段(time)值更新为当前系统时间,请问需要怎么写呢,完全不会php,请大神详细点,先谢谢了
回复讨论(解决方案)   public function hitsaction() {    $id   = (int)$this->get('id');    if (empty($id))    exit;    $data = $this->db->settablename('content')->find($id, 'hits');    $hits = $data['hits'] + 1;    $t = time();    $this->db->settablename('content')->update(array('hits'=>$hits,'time'=>$t), 'id=?' , $id);    echo document.write('$hits');;}
如果你的time字段是datetime类型  
 把$t = time(); 改位 $t=date('y-m-d h:i:s');  
 如果time字段是int  
 则用上面的就可以了。 
      public function hitsaction() {    $id   = (int)$this->get('id');    if (empty($id))    exit;    $data = $this->db->settablename('content')->find($id, 'hits');    $hits = $data['hits'] + 1;    $t = time();    $this->db->settablename('content')->update(array('hits'=>$hits,'time'=>$t), 'id=?' , $id);    echo document.write('$hits');;}
解决了,谢谢
   
 
   