我试图测试这个Google Datastore Library for PHP。我已将GDS文件夹复制到我的应用程序的根目录,并在同一根目录中创建了一个php文件。当我运行代码时,我收到此错误Fatal error: Class 'GDS\Gateway' not found in /home/personal/SampleApp/datastore.php on line 2
datastore.php
<?php
$obj_client = GDS\Gateway::createGoogleClient('AppID', 'xxxx@developer.gserviceaccount.com', 'appKeyFile.p12');
$obj_gateway = new GDS\Gateway($obj_client, 'AppID');
$obj_book_store = new GDS\Store($obj_gateway, 'Book');
$obj_book = new GDS\Entity();
$obj_book->title = 'Romeo and Juliet';
$obj_book->author = 'William Shakespeare';
$obj_book->isbn = '1840224339';
$obj_book_store->upsert($obj_book);
?>
我在这里找不到任何东西?
答案 0 :(得分:1)
你是否使用作曲家拉入图书馆?如果不是,您需要编写自己的自动加载脚本或添加以下行
include_once 'src/GDS/Entity.php';
include_once 'src/GDS/Gateway.php';
include_once 'src/GDS/Store.php';