$v) { if (!in_array($k, $ws_alipay_table_templates)) { unset($_POST[$k]); } } $wpdb->update($wpdb->wsalitemplates, $_POST, array('tplid' => intval($_REQUEST['tplid']))); } //----------------------------------------------------------------------- //insert //----------------------------------------------------------------------- if (empty($_POST) && empty($_GET['tplid'])) { $wpdb->insert($wpdb->wsalitemplates, array('tplname' => '未命名模版')); //echo $wpdb->insert_id; $_GET['tplid'] = $wpdb->insert_id; } //----------------------------------------------------------------------- //delete //----------------------------------------------------------------------- if (isset($_GET['action']) && $_GET['action'] == 'delete' && $_GET['tplid']) { $_GET['tplid'] = esc_sql($_GET['tplid']); if (isset($_GET['sure'])) { $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->wsalitemplates} WHERE `tplid`=%d;", $_GET['tplid'])); return; } ?>
删除后数据不可恢复, 你确定要这样做吗? 确定 取消
get_results("SELECT * FROM {$wpdb->wsalitemplates} WHERE `tplid`={$_GET['tplid']} LIMIT 1;", ARRAY_A); //print_r($data); if (isset($data[0])) { $data = $data[0]; } $htmls = array( array( 'tplid', '模版编号', 'attrs' => array('style' => 'width:30%;margin:auto auto 10px 20px', 'readonly' => 'readonly') ), array('tplname', '模版名称', 'attrs' => array('style' => 'width:30%;margin:auto auto 10px 20px')), array('tpldescription', '模版描述', 'attrs' => array('style' => 'width:70%;margin:auto auto 10px 20px')), array( 'tplcss', '模版CSS代码:(请自行在代码中添加<style>标签,可以使用链接关系)', 'type' => 'textarea', 'attrs' => array('class' => 'ws_alipay_tpl_css') ), array( 'tplhtml', '模版HTML代码:(请直接在<div>标签下写代码)', 'type' => 'textarea', 'attrs' => array('class' => 'ws_alipay_tpl_html') ), array( 'tpljs', '模版javascript代码:(请自行在代码中添加<script>标签,可以使用脚本路径)', 'type' => 'textarea', 'attrs' => array('class' => 'ws_alipay_tpl_js') ), ); $htmls = apply_filters('ws_alipay_templates_htmls', $htmls); ?>

编辑模版