首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SendGrid的PHP库中的sendgrid-php.php文件在哪里?

SendGrid的PHP库中的sendgrid-php.php文件在哪里?
EN

Stack Overflow用户
提问于 2016-07-07 14:25:03
回答 1查看 886关注 0票数 1

我需要在脚本中包含的sendgrid-php.php文件在哪里,以便使用SendGrid的SendGrid库从Github发送邮件?

我已经从https://github.com/sendgrid/sendgrid-php下载了sendgrid的PHP库,我希望在我的脚本中包含sendgrid-php.php。我不是在用作曲家。

我的包看起来像:

代码语言:javascript
复制
require("../lib/sendgrid-2016/sendgrid-php.php");

$from = new SendGrid\Email(null, "from@test.com");
$subject = "Hello World from the SendGrid PHP Library";
$to = new SendGrid\Email(null, "to@test.com");
$content = new SendGrid\Content("text/plain", "some text here");
$mail = new SendGrid\Mail($from, $subject, $to, $content);

$apiKey = getenv('MY API KEY');
$sg = new \SendGrid($apiKey);

$response = $sg->client->mail()->send()->post($mail);
echo $response->statusCode();
echo $response->headers();
echo $response->body(); 

当我运行我的脚本时,我得到了错误:

致命错误:必需():打开失败要求'../lib/sendgrid-2016/sendgrid-php.php‘

查看Github上的zip中包含的文件,我甚至没有看到该文件:来自github的文件列表

EN

回答 1

Stack Overflow用户

发布于 2016-07-13 17:48:42

似乎您已经下载了回购.zip (由github生成),而不是自述的打包zip:https://github.com/sendgrid/sendgrid-php#alternative-install-package-from-zip

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38248024

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档