'mysql', 'database_name' => $Config['DBname'], 'server' => 'localhost', 'username' => $Config['User'], 'password' => $Config['Password'], 'charset' => 'utf8' ); $medoo = new medoo($HYConfig); $opt = array( 'action:', 'proxy_status::',//状态 'server_name::',//域名 'proxy_pass::',//后端 'field_name::',//字段名 'value::',//字段内容 'bak_name::',//备份名称 ); $param = getopt('', $opt); switch ($param['action']) { case 'list': echo amproxy_list($param['proxy_status']); break; case 'add': //echo amproxy_add($param['server_name'], $param['proxy_pass']); break; case 'edit': //echo amproxy_edit($param['server_name'], $param['field_name'], $param['value']); break; case 'del': //echo amproxy_del($param['server_name']); break; default: echo '无效操作'; } /** * 【完成】 * 反向代理列表 * @param $proxy_status = start,stop * @return string */ function amproxy_list($proxy_status = null) { global $medoo; $table = 'module_hyproxy'; $columns = array('server_name','status'); $where = !empty($proxy_status) ? array('status'=>$proxy_status) : ''; $where['ORDER'] = "status"; $list = $medoo->select($table, $columns, $where); $res = ''; foreach ($list as $row) { $status = '[Stop]'; if ($row['status']=='start') { $status = '[Running]'; } $res.=sprintf("%s %s\n", $row['server_name'], $status); } return $res; }