• <tfoot id='1rltE'></tfoot>

    <small id='1rltE'></small><noframes id='1rltE'>

      <bdo id='1rltE'></bdo><ul id='1rltE'></ul>

    1. <legend id='1rltE'><style id='1rltE'><dir id='1rltE'><q id='1rltE'></q></dir></style></legend>

        <i id='1rltE'><tr id='1rltE'><dt id='1rltE'><q id='1rltE'><span id='1rltE'><b id='1rltE'><form id='1rltE'><ins id='1rltE'></ins><ul id='1rltE'></ul><sub id='1rltE'></sub></form><legend id='1rltE'></legend><bdo id='1rltE'><pre id='1rltE'><center id='1rltE'></center></pre></bdo></b><th id='1rltE'></th></span></q></dt></tr></i><div id='1rltE'><tfoot id='1rltE'></tfoot><dl id='1rltE'><fieldset id='1rltE'></fieldset></dl></div>

        Google BigQuery API PHP 凭证

        Google BigQuery API PHP Credential(Google BigQuery API PHP 凭证)
        • <bdo id='ho6Y1'></bdo><ul id='ho6Y1'></ul>
              <i id='ho6Y1'><tr id='ho6Y1'><dt id='ho6Y1'><q id='ho6Y1'><span id='ho6Y1'><b id='ho6Y1'><form id='ho6Y1'><ins id='ho6Y1'></ins><ul id='ho6Y1'></ul><sub id='ho6Y1'></sub></form><legend id='ho6Y1'></legend><bdo id='ho6Y1'><pre id='ho6Y1'><center id='ho6Y1'></center></pre></bdo></b><th id='ho6Y1'></th></span></q></dt></tr></i><div id='ho6Y1'><tfoot id='ho6Y1'></tfoot><dl id='ho6Y1'><fieldset id='ho6Y1'></fieldset></dl></div>

                <tbody id='ho6Y1'></tbody>
              <legend id='ho6Y1'><style id='ho6Y1'><dir id='ho6Y1'><q id='ho6Y1'></q></dir></style></legend>

              <small id='ho6Y1'></small><noframes id='ho6Y1'>

                  <tfoot id='ho6Y1'></tfoot>
                1. 本文介绍了Google BigQuery API PHP 凭证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想实现 Google BigQuery API,以便我可以从 BigQuery 中的 PHP 代码执行查询.

                  I want to implement Google BigQuery API so I can execute query from my PHP code in BigQuery.

                  首先我通过以下命令安装了客户端库:

                  First I have installed the client library by following command:

                  composer require google/cloud
                  

                  其次,我通过以下命令安装了 Google Cloud SDK:

                  Second I have installed the Google Cloud SDK by following command:

                  curl https://sdk.cloud.google.com | bash
                  

                  然后我运行这个命令来创建凭证:

                  Then I run this command to create the credential:

                  gcloud beta auth application-default login
                  

                  所有过程都成功,运行凭据请求后,我收到以下消息:

                  All the process is success and after run credential request I get the following message:

                  Credentials saved to file: 
                  
                  [/home/some/my/dir/application_default_credentials.json]
                  
                  These credentials will be used by any library that requests
                  Application Default Credentials.
                  

                  然后我想在 PHP 上运行这段代码:

                  Then I want to run this code on PHP:

                  # Includes the autoloader for libraries installed with composer
                  require __DIR__ . '/vendor/autoload.php';
                  
                  # Imports the Google Cloud client library
                  use GoogleCloudBigQueryBigQueryClient;
                  
                  # Your Google Cloud Platform project ID
                  $projectId = 'PROJECT ID';
                  
                  # Instantiates a client
                  $bigquery = new BigQueryClient([
                      'projectId' => $projectId
                  ]);
                  
                  # The name for the new dataset
                  $datasetName = 'my_new_dataset';
                  
                  # Creates the new dataset
                  $dataset = $bigquery->createDataset($datasetName);
                  
                  echo 'Dataset ' . $dataset->id() . ' created.';
                  

                  但不幸的是我收到以下消息错误:

                  But unfortunately I got following message error:

                  Fatal error: Uncaught exception 'GoogleCloudExceptionServiceException' with message 'Could not load the default credentials
                  

                  所以我的问题是:出了什么问题,我该怎么办?

                  So my question is: whats wrong and what must I do?

                  谢谢

                  推荐答案

                  默认凭据由 适用于 PHP 的 Google API 客户端库,版本 2.0.0 及更高版本.要使用它们,请调用 useApplicationDefaultCredentials:

                  Default credentials are provided by the Google APIs Client Library for PHP, versions 2.0.0 and newer. To use them, call useApplicationDefaultCredentials:

                  $client = new Google_Client();
                  $client->useApplicationDefaultCredentials();
                  

                  然后,使用凭据访问 API 服务,如下所示:

                  Then, use the credentials to access an API service as follows:

                  $client->setScopes(['https://www.googleapis.com/auth/books']);
                  $service = new Google_Service_Books($client);
                  $results = $service->volumes->listVolumes('Henry David Thoreau');
                  

                  我建议查看我提供的链接有更多选项,我们建议使用服务帐户.

                  I am suggesting checking out the link I gave it has much more options and we recommend using service accounts.

                  这篇关于Google BigQuery API PHP 凭证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

                    <bdo id='4tYpO'></bdo><ul id='4tYpO'></ul>

                    • <legend id='4tYpO'><style id='4tYpO'><dir id='4tYpO'><q id='4tYpO'></q></dir></style></legend>
                        • <small id='4tYpO'></small><noframes id='4tYpO'>

                          <tfoot id='4tYpO'></tfoot>

                            <tbody id='4tYpO'></tbody>
                          <i id='4tYpO'><tr id='4tYpO'><dt id='4tYpO'><q id='4tYpO'><span id='4tYpO'><b id='4tYpO'><form id='4tYpO'><ins id='4tYpO'></ins><ul id='4tYpO'></ul><sub id='4tYpO'></sub></form><legend id='4tYpO'></legend><bdo id='4tYpO'><pre id='4tYpO'><center id='4tYpO'></center></pre></bdo></b><th id='4tYpO'></th></span></q></dt></tr></i><div id='4tYpO'><tfoot id='4tYpO'></tfoot><dl id='4tYpO'><fieldset id='4tYpO'></fieldset></dl></div>