【发布时间】:2014-02-09 07:56:14
【问题描述】:
我正在尝试使用来自 Google App Engine 的 PHP 发送电子邮件。要发送电子邮件,Require Once 必须包含 php 文件 Message.php:请参阅:Code example here at Google
require_once 'google\appengine\api\mail\Message.php';
Message.php 文件包括:
require_once 'google/appengine/api/mail/BaseMessage.php';
BaseMessage.php 文件又需要另外三个 PHP 文件:
require_once 'google/appengine/api/mail_service_pb.php';
require_once 'google/appengine/runtime/ApiProxy.php';
require_once 'google/appengine/runtime/ApplicationError.php';
所以,回顾一下,Message.php 需要 BaseMessage.php 和 BaseMessage.php 需要另外 3 个 php 文件。
在需要最后一个 PHP 文件之前一切正常:
require_once 'google/appengine/runtime/ApplicationError.php';
然后发生致命错误:
Fatal error: Class 'google\appengine\runtime\Error' not found in
C:\Users\UserName\Dropbox\ApplicationName\google\appengine\runtime\
ApplicationError.php on line 22
这是第 22 行:
class ApplicationError extends Error {
这是由 Google 提供的代码:the latest PHP SDK for App Engine
这不是我写的代码。所需文件的路径似乎有效,否则我会在第一个所需文件上收到错误消息。我已经测试了 require_once 引用同一目录中其他 PHP 文件的代码行,没有错误。所以问题不是相对路径或 PHP.ini 文件的问题。
我的 PHP 版本是Current PHP version: 5.4.22
Windows 7的
XAMPP 与 Netbeans、Apache
我该如何解决这个问题?
【问题讨论】:
-
最新的 sdk 具有自动加载功能 - 您不需要对任何 SDK 功能使用 require/include。
-
Google 的示例代码使用
require。我愿意使用我可以开始工作的任何代码。因此,如果有人能指出我的代码和可行的配置,我将不胜感激。
标签: php google-app-engine email