1
我想连接influxDB与PHP,我可以说我几乎成功,都感谢Corley开发PHP api。我很难设置我的查询必须应用的数据库。使用PHP API在InfluxDb中设置数据库
下面是我正在处理的示例PHP代码,如何从可用的数据库列表中选择特定的数据库。
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
use DateTime;
use DateTimeZone;
use InfluxDB\Options;
use InfluxDB\Client;
use InfluxDB\Adapter\GuzzleAdapter;
use GuzzleHttp\Client as GuzzleHttpClient;
use InfluxDB\Integration\Framework\TestCase as InfluxDBTestCase;
require 'composertest/vendor/autoload.php';
error_reporting(E_ALL);
ini_set('display_errors', 'on');
$http = new \GuzzleHttp\Client();
$options = new Options();
$options->setUsername("xyz");
$options->setPassword("1234");
$adapter = new GuzzleAdapter($http, $options);
$client = new Client($adapter);
//I need to select database "Test"
var_dump($client->query('select * from "app-search"'));
?>
</body>
</html>