php 中的 'list' 变量类型是什么?
What is 'list' variable type in php?
我正在尝试使用 google php api 客户端,完全融合 tables。以这种方式创建 table 参数设置:
$postBody = new Google_Service_Fusiontables_Table;
$postBody->setName('Test');
我也应该至少设置一列这样
$postBody->setColumns($columns);
但是文档说 $columns 应该有 'list' 值。这是什么意思?
here it is
String和boolean很清楚,但是list是什么?
根据Googles documentation, it
s 请求正文。语法是什么?大括号是什么意思,如何设置 $columns? request body
看起来它只是一个字符串数组。尽管有一个名为 list().
的不相关函数,但列表不是 PHP 数据类型
这里的列列表是 array 类型。列至少需要这些属性:
- 第
name
列
- 列的
type
("DATETIME"、"LOCATION"、"NUMBER"或"STRING")
当您使用 google php api 客户端时, 列应该是 Google_Service_Fusiontables_Column
[ 的实例=15=]
您可以通过将数组传递给构造函数来直接设置所需的属性:
new Google_Service_Fusiontables_Column(array('type'=>'STRING','name'=>'desiredColumName'));
table(有 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;
我正在尝试使用 google php api 客户端,完全融合 tables。以这种方式创建 table 参数设置:
$postBody = new Google_Service_Fusiontables_Table;
$postBody->setName('Test');
我也应该至少设置一列这样
$postBody->setColumns($columns);
但是文档说 $columns 应该有 'list' 值。这是什么意思? here it is String和boolean很清楚,但是list是什么?
根据Googles documentation, it
s 请求正文。语法是什么?大括号是什么意思,如何设置 $columns? request body
看起来它只是一个字符串数组。尽管有一个名为 list().
的不相关函数,但列表不是 PHP 数据类型这里的列列表是 array 类型。列至少需要这些属性:
- 第
name
列 - 列的
type
("DATETIME"、"LOCATION"、"NUMBER"或"STRING")
当您使用 google php api 客户端时, 列应该是 Google_Service_Fusiontables_Column
[ 的实例=15=]
您可以通过将数组传递给构造函数来直接设置所需的属性:
new Google_Service_Fusiontables_Column(array('type'=>'STRING','name'=>'desiredColumName'));
table(有 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;