问题描述
我无法解决google calander API错误。致命错误:在第13行的C:\ xampp \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ />
我尝试了什么:
require_once'google-api-php- client / src / Google / autoload.php';
session_start();
$ client =新的Google_Client();
$ client-> setAuthConfigFile('client_secret.json');
$ client-> addScope(Google_Service_Drive :: DRIVE_METADATA_READONLY);
if(isset($ _ SESSION ['access_token'])&& $ _SESSION ['access_token']){
$ client- > setAccessToken($ _ SESSION ['access_token']);
$ drive_service = new Google_Service_Drive($ client);
$ files_list = $ drive_service-> files-> ; listFiles(array()) - > getItems();
echo json_encode($ files_list);
} else {
$ redirect_uri ='http://'。 $ _SERVER ['HTTP_HOST']。'/ drive'。 '/ GoogleCalender'。 '/oauth2callback.php';
header('Location:'。filter_var($ redirect_uri,FILTER_SANITIZE_URL));
}
?> ;
require_once'google-api-php-client / src / Google / autoload.php';
session_start();
$ client = new Google_Client();
$ client-> setAuthConfigFile('client_secret.json' );
$ client-> setRedirectUri('http://'。$ _SERVER ['HTTP_HOST']。'/ drive'。'/ GoogleCalender'。'/ another2callback.php');
$ client-> addScope(Google_Service_Drive :: DRIVE_METADATA_READONLY);
if(!isset( $ _GET ['code'])){
$ auth_url = $ client-> createAuthUrl();
header('Location:'。filter_var($ auth_url, FILTER_SANITIZE_URL));
}其他{
$ client-> authenticate($ _ GET ['code']);
$ _SESSION [ 'access_token'] = $ client-> getAccessToken();
$ red irect_uri ='http://'。 $ _SERVER ['HTTP_HOST']。'/ drive'。 '/ GoogleCalender'。 '/';
header('Location:'。filter_var($ redirect_uri,FILTER_SANITIZE_URL));
}
?>
这篇关于Google calander出错。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!