/** * get the xml content of the resource * @return the resource xml content */ public function actionGetResourceXml() { $id = intval($_GET['id']); $data = ResourceManager::findById($id); if ($data) { header('Content-Type: text/xml'); echo $data->uploaded_xml; } else { echo '未找到ID为$id的资源'; } }
/** * delete the resource by id * @param resource 对象 * @return the resource delete result */ public static function delete($resource_id) { $resource = ResourceManager::findById($resource_id); $resource->isDelete = 1; try { $ret = $resource->update(); } catch (Exception $ex) { throw new Exception($ret . "删除资源失败" . $ex->getMessage()); } return $ret; }