dsebywql016137 2019-04-05 09:00
浏览 92
已采纳

如何检测URL中的GET参数,并根据该值放置值?

I am working on a project in PHP and JavaScript, where i have to create a value from my end, and pass the same in URL query string on redirect from my URL, Below is Description: I have a URL, https://abc.amindfad.com/c.php?id={abdid}

on above URL I want redirection, and pass value from my end by detecting where is {abdid}

The above URL will be redirecting from (my URL) :- https://console.adcashod.net/click.php

i have not done anything yet, Because i am little confused in Code which should be used here.

in Results I want that, when I click on (my URL) :- https://console.adcashod.net/click.php

it get redirects to :- https://abc.amindfad.com/c.php?id={abdid} but,

replace {abdid} with a value which is defined by me. for it.

Waiting for suggestions.

  • 写回答

2条回答 默认 最新

  • doubinei1457 2019-04-05 09:54
    关注

    Take a look at this https://www.php.net/manual/en/function.str-replace.php

    $value = 'value_defined_by_me';
    $url = 'https://abc.amindfad.com/c.php?id={abdid}';
    $url = str_replace('{abdid}', $value, $url); //output: https://abc.amindfad.com/c.php?id=value_defined_by_me
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 spring后端vue前端
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题