Php Google BigQuery可捕获致命错误:参数2已传递
我目前正在使用PHP和Google BigQuery,并得到以下错误- 可捕获的致命错误:传递给Google_Service_Bigquery_Jobs_Resource::query()的参数2必须是Google_Service_Bigquery_QueryRequest的实例,未给出,在第34行的/a/a/a.com/a/a/a.php中调用,并在第722行的/a/a/a/a.com/a/Google-api-php-client/src/Google/Service/Bigquery.php中定义 下面是围绕它的代码-Php Google BigQuery可捕获致命错误:参数2已传递,php,google-bigquery,Php,Google Bigquery,我目前正在使用PHP和Google BigQuery,并得到以下错误- 可捕获的致命错误:传递给Google_Service_Bigquery_Jobs_Resource::query()的参数2必须是Google_Service_Bigquery_QueryRequest的实例,未给出,在第34行的/a/a/a.com/a/a/a.php中调用,并在第722行的/a/a/a/a.com/a/Google-api-php-client/src/Google/Service/Bigquery.ph
$service = new Google_Service_Bigquery($client);
$results = $service->jobs->query('SELECT * FROM [table.table] LIMIT 50'); // line 34
以前从未使用过Google BigQuery,因此我不确定我在这里做错了什么,因为错误表明您需要传递
Google\u服务\u BigQuery\u QueryRequest
对象,而不是字符串作为第二个参数
$query = new Google_Service_Bigquery_QueryRequest();
$sql = "SELECT account_number, customer_name, FROM [mydatabase] ORDER BY sales_value DESC, sales_value DESC, sales_value DESC LIMIT 10";
$query->setQuery($sql);
$response = $service->jobs->query($project_id, $query);
echo json_encode($response);
更多信息请访问:此网站修复了它!谢谢你,我的头撞到墙上了!