<?php if (Tools::P('saveFeature') == 'add') { $feature = new Feature(); $feature->copyFromPost(); $feature->add(); if (is_array($feature->_errors) and count($feature->_errors) > 0) { $errors = $feature->_errors; } else { $_GET['id'] = $feature->id; UIAdminAlerts::conf('商品特征已添加'); } } if (isset($_GET['id'])) { $id = (int) $_GET['id']; $obj = new Feature($id); } if (Tools::P('saveFeature') == 'edit') { if (Validate::isLoadedObject($obj)) { $obj->copyFromPost(); $obj->update(); } if (is_array($obj->_errors) and count($obj->_errors) > 0) { $errors = $obj->_errors; } else { UIAdminAlerts::conf('商品特征已更新'); } } /** 输出错误信息 */ if (isset($errors)) { UIAdminAlerts::MError($errors);