$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $data = array('id' => '', 'name' => '', 'sort' => '', 'display' => ''); $title = "添加"; if ("save" == $action) { $data = array('display' => $_POST['display'], 'sort' => $_POST['sort'], 'name' => $_POST['name']); PtpVideoDB::saveCategory($data, $id); //insert or update } else { if ("del" == $action && $id || isset($_POST['act_delete'])) { //delete if ($id) { PtpVideoDB::delCategory($id); } else { $delete_id = $_POST['delete_id']; foreach ($delete_id as $id) { PtpVideoDB::delCategory($id); } } header("Location: ?page=" . PtpVideo::$_category_url); exit; } else { if (!$action && $id) { //select //URL : /wp-admin/admin.php?page=ptp-video-category&file=category_op.php&id=2 $title = "更新"; $data = PtpVideoDB::getCategoryRow($id); } else { if (isset($_POST['act_sort'])) { $sorts = $_POST['sort']; foreach ($sorts as $id => $sort) { $data = array('sort' => $sort);