我想使用谷歌的API PHP客户端库以编程方式导入Google Fusion Table,该库可以在GitHub https://github.com/google/google-api-php-client上找到。它包含一个具有importTable()函数的服务类Fusiontables.php,该函数显然可以执行我喜欢的操作。
/**
* Imports a new table. (table.importTable)
*
* @param string $name The name to be assigned to the new table.
* @param array $optParams Optional parameters.
*
* @opt_param string delimiter The delimiter used to separate cell values. This
* can only consist of a single character. Default is ,.
* @opt_param string encoding The encoding of the content. Default is UTF-8. Use
* auto-detect if you are unsure of the encoding.
* @return Google_Service_Fusiontables_Table
*/
public function importTable($name, $optParams = array())
{
$params = array('name' => $name);
$params = array_merge($params, $optParams);
return $this->call('importTable', array($params), "Google_Service_Fusiontables_Table");
}这个函数读起来很简单,尽管我不知道如何向它提供实际数据,可能是从CSV文件中获取的数据。
我在Google PHP API Client & Fusion Tables: How to use importRows?找到了关于另一个函数importRows()的最新答案。它解释了如何使用optParams数组键' data‘以逗号分隔列表的形式插入实际数据。首先,所有使用的参数都没有在函数的注释中描述,那么哪里可以找到好的文档呢?其次,我不清楚如何指定由几行组成的数据(因为函数名是复数形式的“rows”)。
希望找到一些关于这个Google API PHP客户端库的专家。
发布于 2018-02-22 02:54:42
PHP函数的
importRows导入的数据的一般格式为CSV。因此,要指定多个行,输入blob中的行应由适当的换行符分隔。https://stackoverflow.com/questions/33647851
复制相似问题