/** * api_encode function. * * @access public * @return void */ function api_encode() { $this->app_check("post"); $_arr_data = validateStr(fn_post("data"), 1, 0); switch ($_arr_data["status"]) { case "too_short": $_arr_return = array("alert" => "x080201"); $this->obj_api->halt_re($_arr_return); break; case "ok": $_str_data = html_entity_decode($_arr_data["str"]); break; } $_str_key = fn_rand(6); $_str_code = fn_baigoEncode($_str_data, $_str_key); $_arr_return = array("code" => $_str_code, "key" => $_str_key, "alert" => "y050405"); $this->obj_api->halt_re($_arr_return); }
/** 编码 * sync_encode function. * * @access public * @param mixed $arr_data * @param mixed $str_key * @return void */ function sync_encode($arr_data, $str_key) { unset($arr_data["alert"]); $_str_src = fn_jsonEncode($arr_data, "encode"); $_str_code = fn_baigoEncode($_str_src, $str_key); return $_str_code; }
/** 编码 * api_encode function. * * @access public * @param mixed $arr_data * @param mixed $str_key * @return void */ function api_encode($arr_data, $str_key, $method = "encode") { unset($arr_data["alert"]); $_str_src = fn_jsonEncode($arr_data, $method); $_str_code = fn_baigoEncode($_str_src, $str_key); return $_str_code; }