#str_pad 补位
$sn = 'SN'.str_pad($goods_id, 8, '0', STR_PAD_LEFT ); $this->where('id='.$goods_id)->save(array( 'goods_sn'=>$sn, ));