Google Sheet UpdateValuesResponse()
Google Sheet UpdateValuesResponse()
我更新了 Google 中的值 Sheet 修改了这个 quiqstart 文件:https://developers.google.com/sheets/api/quickstart/php
更新后,我需要 google api 的回复,一切正常(没有错误)。如何测试更新成功?如何制作?
我试过了:
$result = $service->spreadsheets_values->update($spreadsheetId, $range, $body, $params);
$test=$result->UpdateValuesResponse();
printf($test);
有错误:
PHP Fatal error: Uncaught Error: Call to undefined method Google_Service_Sheets_UpdateValuesResponse::UpdateValuesResponse() in
/var/www/html/writegs.php:101 Stack trace:
> #0 {main} thrown in /var/www/html/writegs.php on line 101
在此处查看文档:
https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update
根据此处给出的 PHP 示例,您从 update
返回的响应是一个 UpdateValuesResponse 对象。那不是方法。
因此,如果您只是想测试是否获得了成功响应,请尝试:
$result = $service->spreadsheets_values->update($spreadsheetId, $range, $body, $params);
echo '<pre>', var_export($result , true), '</pre>', "\n";
$result = json_decode($result);
$updatedCells = $result->updatedCells;
我更新了 Google 中的值 Sheet 修改了这个 quiqstart 文件:https://developers.google.com/sheets/api/quickstart/php 更新后,我需要 google api 的回复,一切正常(没有错误)。如何测试更新成功?如何制作? 我试过了:
$result = $service->spreadsheets_values->update($spreadsheetId, $range, $body, $params);
$test=$result->UpdateValuesResponse();
printf($test);
有错误:
PHP Fatal error: Uncaught Error: Call to undefined method Google_Service_Sheets_UpdateValuesResponse::UpdateValuesResponse() in /var/www/html/writegs.php:101 Stack trace: > #0 {main} thrown in /var/www/html/writegs.php on line 101
在此处查看文档: https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update
根据此处给出的 PHP 示例,您从 update
返回的响应是一个 UpdateValuesResponse 对象。那不是方法。
因此,如果您只是想测试是否获得了成功响应,请尝试:
$result = $service->spreadsheets_values->update($spreadsheetId, $range, $body, $params);
echo '<pre>', var_export($result , true), '</pre>', "\n";
$result = json_decode($result);
$updatedCells = $result->updatedCells;