コード例 #1
0
ファイル: Article.php プロジェクト: tanqinwang/test_own
 public function delAction()
 {
     $p = $_REQUEST;
     $pId = empty($p['id']) ? die('error') : intval($p['id']);
     $tMO = new ArticleModel();
     $tRow = $tMO->field('head_img')->where('id = ' . $pId)->fRow();
     if (!empty($tRow['head_img'])) {
         unlink(APPLICATION_PATH . '/public' . $tRow['head_img']);
     }
     $tSql = 'delete from ' . $tMO->table . ' where id = ' . $pId;
     if (!$tMO->exec($tSql)) {
         Tool_Fnc::ajaxMsg('删除失败');
     }
     Tool_Fnc::ajaxMsg('删除成功', 1);
 }