我有一个 URL,它成为具有该http_build_query
函数的查询字符串。
但是我有一个timestamp
无法编辑的参数。并×
成为乘号x
。
有解决方法吗?
这是我传递给http_build_query
函数的数组。
$parameters = array(
"transaction_id"=>uniqid("FF-"),
"timestamp"=> time(),
"order_total"=>$_SESSION['total_price'],
"order_total_with_vat"=>$_SESSION['total_price'] * 1.21,
"order_vat"=>"21",
"payment_method"=>"ideal",
"payment_status"=>"1",
"customer_name"=>$_SESSION['customer_data']['naam'],
"customer_address"=>$_SESSION['customer_data']['address'],
"customer_city"=>$_SESSION['customer_data']['city'],
"customer_zipcode"=>$_SESSION['customer_data']['zipcode'],
"customer_country"=>$_SESSION['customer_data']['country'],
"customer_email"=>$_SESSION['customer_data']['email'],
"customer_telephone"=>$_SESSION['customer_data']['telephone'],
);
Run Code Online (Sandbox Code Playgroud)
网址输出:
http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9×tamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5
Run Code Online (Sandbox Code Playgroud)
首选输出:
http://somedomain/subdir/someapi/order?transaction_id=FF-58e2451c5aea9×tamp=1491223836&order_total=156695&order_total_with_vat=189600.95&order_vat=21&payment_method=ideal&payment_status=1&customer_name=t&customer_address=t&customer_city=t&customer_zipcode=t&customer_country=t&customer_email=t%40t&customer_telephone=t&product%5B0%5D=5&product%5B1%5D=5&product%5B2%5D=5&product%5B3%5D=5&product%5B4%5D=5&product%5B5%5D=5&product%5B6%5D=5
Run Code Online (Sandbox Code Playgroud)
http_build_query
功能:
case 'POST':
curl_setopt( $curlHandler, CURLOPT_POST, true );
$url .= '?' . http_build_query( $parameters );
break;
Run Code Online (Sandbox Code Playgroud) 假设我想加入2个表,其中一个表是这样的.
| Category |
|-----------|
| id | name |
|----|------|
| 1 | Foo |
| 2 | Bar |
| 3 | Baz |
Run Code Online (Sandbox Code Playgroud)
另一个是这样的:
| Page |
|-----------|
| id | cat |
|----|------|
| 1 | 0 |
| 2 | 1 |
| 3 | 3 |
Run Code Online (Sandbox Code Playgroud)
如您所见,Page
表中的cat 0 不存在于Category
表中.不幸的是,我们的系统是这样0
的Category
,由于其他代码,我无法将带有id的类别添加到表中.
现在到了一百万美元的问题:是否有可能加盟category.id
的page.cat
,并设置一个if语句时,page.cat
等于0
以显示分类名称Default
?