這裏列的列表是類型array。列至少需要這些屬性:
- 塔的
name
- 列的
type
( 「日期時間」, 「地點」, 「數字」 或 「STRING」)
當您使用谷歌PHP API客戶端一列由通過陣列傳遞他們預計的Google_Service_Fusiontables_Column
您可以直接設置所需的屬性實例構造函數:
new Google_Service_Fusiontables_Column(array('type'=>'STRING','name'=>'desiredColumName'));
一個完整的創建表(2列)的是這樣的:
//create FusionTable-instance
$table = new Google_Service_Fusiontables_Table;
//set table-name
$table->setName('myTableName');
//set required option isExportable
$table->setIsExportable('true');
//set column(s)
$table->setColumns(array(
new Google_Service_Fusiontables_Column(array('type'=>'STRING',
'name'=>'columnName')),
new Google_Service_Fusiontables_Column(array('type'=>'NUMBER',
'name'=>'otherName'))
)
);
//insert the table
//$service is a Google_Service_Fusiontables-instance
$result = $service->table->insert($table);
//display Id of the new FusionTable
echo $result->tableId;
你確定你正在閱讀的PHP文件 – RiggsFolly
沒有,但可以去看沒有PHP文檔 –