如何从app_id=ECFAAF02&build=7972009&channel=AppStore&deviceId=042979DC-95E8-44B5-A5C1-6353165104D7&device_fingerprint=2022022518044014ebaf68ec1de1cbce0fdd52cebf925b01d48a8645d1f5e4&device_fingerprint1=20
您可以使用JavaScript的字符串方法indexOf()来判断参数字符串中是否包含特定参数,如下所示:
const queryString = "app_id=ECFAAF02&build=7972009&channel=AppStore&deviceId=042979DC-95E8-44B5-A5C1-6353165104D7&device_fingerprint=2022022518044014ebaf68ec1de1cbce0fdd52cebf925b01d48a8645d1f5e4&device_fingerprint1=2022022518044014ebaf68ec1de1cbce0fdd52cebf925b01d48a8645d1f5e4&device_model=phone&fid=1645783477-0-0-90704efd54ec3345cef11c67d1c357e2&gid=7df4edd94455556ea0399e36668cc2763a9f8ca847359a1b77ad4a26&identifier_flag=0&lang=zh-Hans&launch_id=712581471&platform=iOS&project_id=ECFAAF&sid=session.1690883232437272952510&t=1690901113&teenager=0&tz=Asia/Shanghai&uis=light&version=7.97.2";
if (queryString.indexOf('sid=') !== -1) {
console.log('参数中包含sid');
} else {
console.log('参数中不包含sid');
}
这段代码会输出参数中包含sid,因为参数字符串中确实包含sid=
原文地址: https://www.cveoy.top/t/topic/irKS 著作权归作者所有。请勿转载和采集!