Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unix 在curl中的get request中发送多个请求参数,只执行单个参数_Unix_Curl_Get - Fatal编程技术网

Unix 在curl中的get request中发送多个请求参数,只执行单个参数

Unix 在curl中的get request中发送多个请求参数,只执行单个参数,unix,curl,get,Unix,Curl,Get,我试图通过命令行向我的api发出curl-get请求 curl http://localhost:8080/getList?id=100&mrp=50&discount=0 但当我在api中记录请求时,我得到: &{GET /getList?id=100 HTTP/1.1 1 1 which means that only id is being sent through the request. I don't understand why it is happen

我试图通过命令行向我的api发出curl-get请求

curl http://localhost:8080/getList?id=100&mrp=50&discount=0
但当我在api中记录请求时,我得到:

&{GET /getList?id=100 HTTP/1.1 1 1  which means that only id is being sent through the request. I don't understand why it is happening.

当您使用由
&
分隔的多个请求参数运行curl命令时,unix将
&
视为在后台执行上一个命令的符号。它后面的所有内容都将被视为单独的命令

发送请求时将url包装在引号中

curl "http://localhost:8080/getList?id=100&mrp=50&discount=0"

复制/粘贴url时没有查看鼠标下方,这是一个愚蠢的错误。