我正在使用google-趋势库并与composer一起安装它
composer update jonasva/google-trends我的composer.json
{
"require": {
"jonasva/google-trends": "dev-master"
}
} 我将文件start.php包括在主文件夹中:
require __DIR__ . '/vendor/autoload.php';
$config = [
'email' => 'myemail@gmail.com',
'password' => 'mypass',
];
$session = (new GoogleSession($config))->authenticate();
$response = (new GoogleTrendsRequest($session))
->setDateRange(new \DateTime('2014-02-01'), new \DateTime()) // date range, if not passed, the past year will be used by default
->setLocation('BE') // For location Belgium
->getTopQueries() // cid (top queries)
->send(); //execute the request
$data = $response->getTermsObjects(); // return an array of GoogleTrendsTerm objects但我得到
致命错误:未在
我应该包括vendor/autoload.php以外的文件吗?
发布于 2016-03-16 16:28:27
作者很方便地没有提到实际的完全限定类名是Jonasva\GoogleTrends\GoogleSession。
use Jonasva\GoogleTrends\GoogleSession;位于文件的顶部。
检查库的源代码,找出这样的信息。
发布于 2016-03-16 16:29:15
你必须使用FQDN。命名空间+类名
$session = (new Jonasva\GoogleTrends\GoogleSession($config))->authenticate();https://stackoverflow.com/questions/36041423
复制相似问题