예제 #1
0
 /**
  * 添加/修改页面
  */
 public function detail()
 {
     // 限制表单上传的最大值
     $this->MAX_FILE_SIZE = 1024000;
     $cmo = new Model('category');
     $cidList = $cmo->select();
     $this->cidList = Arr::simple($cidList);
     if (empty($_GET['id']) || !ctype_digit($_GET['id'])) {
         $detail = array();
     } else {
         $id = $_GET['id'];
         $mo = new Model_Article();
         $detail = $mo->read($id);
     }
     if ($detail) {
         $detail['post_time'] = date('Y-m-d H:i:s', $detail['post_time']);
         $this->detail = $detail;
     } else {
         $this->detail = array('status' => 1, 'views' => rand(1, 99), 'post_time' => date('Y-m-d H:i:s'));
     }
 }