I am using mandrill's api for sending email through my project made in core php. i followed steps as given here
我正在使用mandrill的api通过我的核心php项目发送电子邮件。我按照这里给出的步骤
Instead of adding as 'use' i have included the respective files in my page & called the api. But it has shown me the above error. The architecture of api is little bit framework like. I havent worked on framework yet. Don't have any idea how it can be resolved.
我没有添加为“使用”,而是将相应的文件包含在我的页面中并调用了api。但它向我展示了上述错误。 api的架构有点像框架。我还没有在框架上工作过。不知道如何解决它。
i did following
我做了以下
include '../api/mandrill-api-php/vendor/autoload.php';
include '../api/mandrill-api-php/vendor/jlinn/mandrill-api-php/src/Mandrill/Mandrill.php';
include '../api/mandrill-api-php/vendor/jlinn/mandrill-api-php/src/Mandrill/Struct/Message.php';
include '../api/mandrill-api-php/vendor/jlinn/mandrill-api-php/src/Mandrill/Struct/Recipient.php';
it is showing me error class mandrill not found.
它显示我找不到错误类mandrill。
1 个解决方案
#1
Including only those 3 dependencies is not enough, because mandrill has other dependencies on its classes. What you could do is install the mandrill-api using composer as suggested in mandrill-api readme:
仅包含那3个依赖项是不够的,因为mandrill对其类有其他依赖性。您可以做的是按照mandrill-api自述文件中的建议使用composer安装mandrill-api:
php composer.phar require jlinn/mandrill-api-php:~1.0
Then, in your php, include the autoload file:
然后,在您的PHP中,包括自动加载文件:
require 'vendor/autoload.php';
#1
Including only those 3 dependencies is not enough, because mandrill has other dependencies on its classes. What you could do is install the mandrill-api using composer as suggested in mandrill-api readme:
仅包含那3个依赖项是不够的,因为mandrill对其类有其他依赖性。您可以做的是按照mandrill-api自述文件中的建议使用composer安装mandrill-api:
php composer.phar require jlinn/mandrill-api-php:~1.0
Then, in your php, include the autoload file:
然后,在您的PHP中,包括自动加载文件:
require 'vendor/autoload.php';