繁体   English   中英

请求时如何在 guzzle http 中传递大于或小于运算符

[英]How to pass greater than or less than operator in guzzle http when doing request

如何使用 guzzle 使用大于运算符的查询字符串正确发送请求? 在这里,我想提取 dateLastModified 大于特定日期的所有记录

$this->client = new Client([
            'base_uri'  => $base_url . $version . '/',
            'handler'   => $stack,
            'auth'      => 'oauth'
        ]);

$query_string = "?filter=status='active'&dateLastModified>" . "'"$some_date"'" . "&limit=500";
$response = $this->client->get('/students' . $query_string);

我被抛出以下错误。 请注意,大于符号已更改

filter=status='active'&dateLastModified%3E'2021-09-01T16:39:00.000Z'&limit=15000` resulted in a `401 Unauthorized` response: {"errors":[{"codeMajor":"FAILURE","severity":"ERROR","codeMinor":"UNAUTHORIZED","description":"User not authorized."}]}

大于符号被编码。 (因为你发送一个 GET 并且%3E相当于> )所以解码它,在发送到数据库之前应该修复它: https://www.php.net/manual/en/function.urldecode.php

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM