最新的 PHP 客户端库 v2.0 已重命名这些类。所以现在的代码变成了:
$client = new Google_Client();
$client->setAuthConfig('oauth-credentials.json');
$client->addScope("https://www.googleapis.com/auth/fusiontables");
if (isset($_SESSION['access_token']) && $_SESSION['access_token'])
{
$client->setAccessToken($_SESSION['access_token']);
$service = new Google_Service_Fusiontables($client);
}
$tableId = "{enter_your_table_id}";
$style = $service->style->insert($tableId, new Google_Service_Fusiontables_StyleSetting(array(
'markerOptions' => new Google_Service_Fusiontables_PointStyle(array(
"iconStyler" => new Google_Service_Fusiontables_StyleFunction(array(
"kind" => "fusiontables#fromColumn",
"columnName" => "markerColor"
))
)),
'polylineOptions' => new Google_Service_Fusiontables_LineStyle(array(
"strokeColorStyler" => new Google_Service_Fusiontables_StyleFunction(array(
"kind" => "fusiontables#fromColumn",
"columnName" => "polylineStrokeColor"
)),
"strokeWeightStyler"=> new Google_Service_Fusiontables_StyleFunction(array(
"kind" => "fusiontables#fromColumn",
"columnName" => "polylineStrokeWeight"
))
)),
'polygonOptions' => new Google_Service_Fusiontables_PolygonStyle(array(
"fillColorStyler" => new Google_Service_Fusiontables_StyleFunction(array(
"kind" => "fusiontables#fromColumn",
"columnName" => "polygonFillColor"
)),
"strokeColorStyler" => new Google_Service_Fusiontables_StyleFunction(array(
"kind" => "fusiontables#fromColumn",
"columnName" => "polylineStrokeColor"
)),
"strokeWeightStyler"=> new Google_Service_Fusiontables_StyleFunction(array(
"kind" => "fusiontables#fromColumn",
"columnName" => "polylineStrokeWeight"
))
)),
"isDefaultForTable" => true
))
);
更多信息可以在这里找到:
(1)创建样式
(2)参考