小编Fra*_*oot的帖子

http_build_query 忽略一键

我有一个 URL,它成为具有该http_build_query函数的查询字符串。

但是我有一个timestamp无法编辑的参数。并&times成为乘号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&timestamp=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)

php query-string

3
推荐指数
1
解决办法
702
查看次数

SQL - 左连接失败时显示列中的值

假设我想加入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表中.不幸的是,我们的系统是这样0Category,由于其他代码,我无法将带有id的类别添加到表中.

现在到了一百万美元的问题:是否有可能加盟category.idpage.cat,并设置一个if语句时,page.cat等于0以显示分类名称Default

mysql join left-join

0
推荐指数
1
解决办法
73
查看次数

标签 统计

join ×1

left-join ×1

mysql ×1

php ×1

query-string ×1