我使用 XAMPP 1.8.2-6 附带的 PHP 5.4 并尝试使用以下代码实现 gettrainedmodels 函数。
require_once 'google-api-client/vendor/autoload.php';
$client = new Google_Client();
$client->setApplicationName('Testing Application');
$client->addScope(Google_Service_Prediction::PREDICTION);
$client->setAuthConfig('auth.json');
$predictionService = new Google_Service_Prediction($client);
$projectId = 'some-project-id';
$predictionService->trainedmodels->listTrainedmodels($projectId);
该服务器是使用 PHP 内部开发服务器启动的。但是,listTrainedmodels
执行时,浏览器返回“ERR_CONNECTION_RESET”。
尝试将 cacret.pem 添加到 php.ini 并启用 openssl,但仍然没有运气。