【发布时间】:2021-03-04 10:06:51
【问题描述】:
我读到了article 关于 Google Sheet API v4 更新的内容。我需要更改当前的代码结构吗?
我正在使用simple JSON data 在网络上显示 Google 表格数据。我在网上做了一些 PHP 和 JavaScript 基础项目,使用下面的代码:
.HTML
var sf = https://spreadsheets.google.com/feeds/list/1l7VfPOI3TYtPuBZlZ-JMMiZW1OK6rzIBt8RFd6KmwbA/1/public/values?alt=json
$.getJSON(sf, function(data) {
var sd = data.feed.entry;
key = data.feed.entry[i]['gsx$key']['$t'];
name = data.feed.entry[i]['gsx$name']['$t'];
img = data.feed.entry[i]['gsx$img']['$t'];
rice = data.feed.entry[i]['gsx$price']['$t'];
.php
$url = 'https://spreadsheets.google.com/feeds/list/1l7VfPOI3TYtPuBZlZ-JMMiZW1OK6rzIBt8RFd6KmwbA/1/public/values?alt=json';
$file = file_get_contents($url);
$json = json_decode($file);
$rows = $json->{'feed'}->{'entry'};
$key = $row->{'gsx$key'}->{'$t'};
$price = $row->{'gsx$price'}->{'$t'};
$img = $row->{'gsx$img'}->{'$t'};
$name = $row->{'gsx$name'}->{'$t'};
我真的需要更新什么吗?
【问题讨论】:
标签: javascript php google-apps-script google-sheets google-sheets-api