one($type); $where['key'] = md5($url . '?' . $param); $info = Dever::db('short/info')->one($where); if ($info) { $id = $info['id']; } else { $where['url'] = $url; $where['param'] = $param; $id = Dever::db('short/info')->insert($where); } if ($host) { $type['host'] = $host; } return $type['host'] . Dever::uid($id); } public function show($str) { $id = Dever::uid($str, 'decode'); if ($id && $id > 0) { $info = Dever::db('short/info')->one($id); if ($info && $info['url']) { $param = json_decode($info['param'], true); foreach ($param as $k => $v) { if (strstr($v, '|')) { $temp = explode('|', $v); $v = Dever::load($temp[1], $temp[0]); $param[$k] = $v; } } Dever::location($info['url'] . '?' . http_build_query($param)); } } return 'error'; } }