我正在尝试使用woocommerce REST API。乍一看,通过以下文档看起来很简单:qazxsw poi。但我努力使其发挥作用。这是我的代码:
https://woocommerce.github.io/woocommerce-rest-api-docs/?php#introduction
这是我得到的:
致命错误:Uncaught Automattic \ WooCommerce \ HttpClient \ HttpClientException:/Applications/MAMP/htdocs/WC_REST/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php:346中的语法错误堆栈跟踪:#0 / Applications / MAMP /htdocs/WC_REST/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php(385):Automattic \ WooCommerce \ HttpClient \ HttpClient-> processResponse()#1 / Applications / MAMP / htdocs / WC_REST / vendor / automattic /woocommerce/src/WooCommerce/Client.php(82):Automattic \ WooCommerce \ HttpClient \ HttpClient-> request('','GET',Array,Array)#2 /Applications/MAMP/htdocs/WC_REST/test.php (19):Automattic \ WooCommerce \ Client-> get('')#3 {main}在346行/Applications/MAMP/htdocs/WC_REST/vendor/automattic/woocommerce/src/WooCommerce/HttpClient/HttpClient.php中抛出
我写下了文档中的内容。
我总是在这台服务器上找不到'/ wp-json / wc / v2 / system_status。'如上所述启用$ body的输出时出错。
我修复了它,启用了永久链接(在admin-backend中),这是访问斜杠分隔的URL所必需的。