似乎无法让分页在我的 WooCommerce REST API 应用程序上工作?

Cant seem to get the Pagination to work on my WooCommerce REST API application?

到目前为止我得到了什么:

        [
            'wp_api' => true,
            'version' => 'wc/v3',
            'query_string_auth' => true //Force Basic Authentication as query string true and using under HTTPS
            
        ]
    );
        

try {
    $results = $woocommerce->get('orders?per_page=30');
    $result = count($results);

我试图删除 query_string_auth 但我没有显示任何数据。 仅供参考,它可以在没有 page=30 的情况下工作,但只显示前 10 个项目。

任何建议都会有很大帮助:

Get 方法接受额外的参数。

$woocommerce->get($endpoint, $parameters = []);

这样试试

$woocommerce->get('orders', array('per_page' => 30));

更多详情可见here

如果您使用的是 Nginx,请检查您的 Nginx 配置。缺少 Nginx 设置将忽略 GET 方法查询参数。所以这可能是您的页面或 per_page 参数被忽略的问题。