用php替换url中的句号

用php替换url中的句号,php,Php,我试图在url中发送一些参数,但是参数rvn抛出了一个错误,因为它有一个句号(这是一个价格)。我怎样才能避开这件事?我不想去掉句号,所以需要用一些东西来代替它 以下是我的完整url: https://example.com/subscription.js?tid=GC-54541&subid=SUBS-9634-REO&rvn=6.6&cid=17268 下面是生成它的代码: $client = new \GuzzleHttp\Client();

我试图在url中发送一些参数,但是参数
rvn
抛出了一个错误,因为它有一个句号(这是一个价格)。我怎样才能避开这件事?我不想去掉句号,所以需要用一些东西来代替它

以下是我的完整url:

https://example.com/subscription.js?tid=GC-54541&subid=SUBS-9634-REO&rvn=6.6&cid=17268
下面是生成它的代码:

        $client = new \GuzzleHttp\Client();
        $callback = $client->request('GET', 'https://example.com/subscription.js?aid=c-a-totmsubs-uk', [
        'query' => [
                'tid' => $transaction_id,
                'subid' => $reference,
                'rvn' => $total_price,
                'cid' => $customer_id,
            ]
        ]);
        $status = $callback->getStatusCode();
        echo "<script type='text/javascript'>alert('$status');</script>";
$client=new\GuzzleHttp\client();
$callback=$client->request('GET','https://example.com/subscription.js?aid=c-a-totmsubs-uk’[
“查询”=>[
'tid'=>$transaction\u id,
“subid”=>$reference,
“rvn”=>$总价,
“cid”=>$customer\u id,
]
]);
$status=$callback->getStatusCode();
回显“警报('$status');”;

如果要用其他内容替换get参数中的fullstop,可以使用以下功能:

$url = 'https://example.com/subscription.js?tid=GC-54541&subid=SUBS-9634-REO&rvn=6.6&cid=17268';

function replaceFullstop($url, $with) {
    $url = explode('?', $url);

    $url1 = $url[0] . '?';
    $url2 = str_replace('.', $with, $url[1]);

    return $url1 . $url2;
}

echo replaceFullstop($url, '_');

你能给我们看看你的密码吗?如何创建此URL?URL编码URL程序集上的参数(句号为%2E)以及错误消息是什么?在您正在检索的js文件
rvn
上,您可以使用
parseFloat(您的变量)