gpt4 book ai didi

javascript - 如何从 Javascript 的 URL 中提取 GET 参数?

转载 作者:数据小太阳 更新时间:2023-10-29 04:41:24 27 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
Use the get parameter of the url in javascript

假设我有这个网址:

s = 'http://mydomain.com/?q=microsoft&p=next'

在这种情况下,如何从字符串中提取“microsoft”?我知道在 python 中,它将是:

new_s = s[s.find('?q=')+len('?q='):s.find('&',s.find('?q='))]

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com