$msg = '操作成功'; global $currentUserInfo; $typeid = (int) $_REQUEST['typeid']; $id = (int) $_REQUEST['id']; switch ($act) { case 'update': $item = array('id' => $id, 'typeid' => $typeid, 'content' => stripslashes($_REQUEST['text']), 'title' => stripslashes($_REQUEST['title']), 'lang' => 'ch', 'itemtime' => time(), 'minimg' => stripslashes($_REQUEST['minimg']), 'maximg' => stripslashes($_REQUEST['maximg'])); if ($id) { ContentList::update($item); } else { ContentList::add($item); } break; case 'delete': if ($id) { $result = ContentList::del(array('id' => $id)); if ($result > 0) { $code = 0; $msg = "删除成功"; } else { $code = 1; $msg = "删除失败"; } } else { $code = 1; $msg = "无效的id"; } break; default: $code = 1; $msg = '没有这个操作';
<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/../init.inc.php'; $params = array('condition' => array(array('typeid', 1))); //echo json_encode(ContentList::getList($params)); $indextype = ContentList::getList($params); ContentList::del($params); Template::assign('indextype', $indextype); Template::display('ht/module/index.tpl');