1
我试图传递数组来卷曲参数,但是卷曲会在请求中添加反斜杠。卷曲添加反斜杠
PHP代码:
$domain = 'website.com';
curl_setopt($ch, CURLOPT_URL, "http://domain.com/x.json?domains='[\"".$domain."\"]'");
日志:
"GET /x.json?domains='[\"http://website.com\"]' HTTP/1.1" 200 105 "-" "-"
正如你所看到的阵列看起来像'[\"http://website.com\"]'
不'["http://website.com"]'
。
有人可以帮助我。
结果:域=%5B%22http%3A%2F%website.com%22%5D – Pixel
在记录它看起来是这样,但如果你要打印出$ _GET [ 'domains']你将得到JSON数组作为字符串。 –