可以使用web_reg_save_param()方法,正则获取字符串然后保存到参数中,使用lr_convert_string_encoding()方法进行编码转换:
lr_convert_string_encoding(想要装换的字符串,编码格式,NULL,保存到的参数名);
Action代码:
Action() {// 正则取信息 web_reg_save_param("msg", "LB=\"message\":\"", "RB=\"}", LAST); // 添加header web_add_header("Content-Type", "application/json"); /* 发送请求 */ web_custom_request("login", "URL=http://localhost:8080/InterfaceProject/login", "Method=POST", "TargetFrame=", "Resource=0", "Referer=", "Body={\"username\":\"755\",\"password\":\"445\"}", LAST); // 转换编码格式 lr_convert_string_encoding(lr_eval_string("{msg}"),"utf-8",NULL,"res"); // 输出 lr_output_message(lr_eval_string("{res}")); return 0; }
结果: