我的代码是
$data = array('promoCode' => $_POST["00"]);
$data_string = json_encode($data);
$url="http://website.com/promotions/(here)" . $name;
$auth_code = $_POST["auth"];
$name = $_POST["voucher"];
$ch = curl_init(); ;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_POST, count($data_string));
curl_setopt($ch, CURLOPT_POSTFIELDS, ($data_string));
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: ' . $auth_code,
'Connection: close'
));
我想在/
的斜杠http://website.com/promotions/
后添加字符串
我需要像$name = $_POST["voucher"];
一样添加它,以将其与html输入连接。
答案 0 :(得分:0)
您要在声明之前使用$name
变量。重新放置$name
声明,使其位于$url
声明之前,如下所示:
$name = $_POST["voucher"];
$url="http://website.com/promotions/" . $name;