sql = new mysqli($this->host, $this->un, $this->ps, $this->db); } //mysql调用 public static function usselect($p) { $a = explode(",", $p); $e = (new con()); $e = $e->sql; $j = ""; //错误处理 if ($e->connect_error) { return ""; } $e->set_charset("utf8"); $s = ""; $e->query("set character set 'utf8';"); $res = ""; $sqlname = urldecode(urldecode($a[0])); if (count($a) > 1) { for ($i = 1; $i < count($a); $i++) { $a[$i] = urldecode(urldecode($a[$i])); } $s = "CALL " . $sqlname . "('" . join("','", array_slice($a, 1)) . "');"; } else { $s = "CALL " . $sqlname . "()"; } // echo $s; $r = array(); $e->multi_query(urldecode($s)); do { $s = array(); if ($res = $e->store_result()) { while ($v = $res->fetch_array(MYSQLI_ASSOC)) { array_push($s, $v); } array_push($r, $s); } } while ($e->more_results() && $e->next_result()); $j = json_encode(count($r) > 1 ? $r : (count($r) == 0 ? $e->affected_rows : $r[0])); con::close($e); return $j; //获取返回的值 } //回收占用问题 function __destruct() { con::close($this->sql); } } ?>