我需要在脚本中包含的sendgrid-php.php文件在哪里,以便使用SendGrid的SendGrid库从Github发送邮件?
我已经从https://github.com/sendgrid/sendgrid-php下载了sendgrid的PHP库,我希望在我的脚本中包含sendgrid-php.php。我不是在用作曲家。
我的包看起来像:
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的文件列表
发布于 2016-07-13 17:48:42
似乎您已经下载了回购.zip (由github生成),而不是自述的打包zip:https://github.com/sendgrid/sendgrid-php#alternative-install-package-from-zip
https://stackoverflow.com/questions/38248024
复制相似问题