gpt4 book ai didi

php - 在 PHP 中,是否可以将最后一次 curl 尝试的语法作为字符串获取?

转载 作者:太空宇宙 更新时间:2023-11-04 05:58:42 25 4
gpt4 key购买 nike

偶尔我想通过在Linux终端中运行实际的curl命令来调试curl请求是否可以以字符串格式获取PHP生成的命令来获取curl命令,类似这样?

curl -X PUT \
-H "x-pushbots-appid: 54cc0a511d0ab13c0528b459d" \
-H "x-pushbots-secret: 1444fe8be3324ff7128f25aa18cdee12" \
-H "Content-Type: application/json" \
-d '{ "token" : String , "platform" : String , "lat" : String , "lng" : String , "active" : Array , "tag" : Array , "alias" : String }' \
https://api.pushbots.com/deviceToken

最佳答案

您需要避免 CLI 执行,因为调试它非常困难。我建议您使用 PHP 的 cURL 扩展 ( http://php.net/manual/en/ref.curl.php ),然后您可以使用以下命令进行调试:

  1. Try-Catch(异常处理)
  2. error_get_last()
  3. function() OR die("---log/Break code --");

关于php - 在 PHP 中,是否可以将最后一次 curl 尝试的语法作为字符串获取?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30152482/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com