【问题解决】linux下curl get方法无法获取参数

问题阐述

例如
url 为 http://mywebsite.com/index.php?a=1&b=2&c=3
web形式下访问url地址,使用$_GET是可以获取到所有的参数
然而在linux下
curl http://mywebsite.com/index.php?a=1&b=2&c=3
$_GET只能获取到参数a
由于url中有&,其他参数获取不到,在linux系统中& 会使进程系统后台运行

解决方案

必须对&进行下转义’&'才能$_GET获取到所有参数
curl http://mywebsite.com/index.php?a=1&b=2&c=3
或者使用``符号包含url链接
curl http://mywebsite.com/index.php?a=1&b=2&c=3

猜你喜欢

转载自blog.csdn.net/weixin_44704985/article/details/113970412