Centos 如何配置和使用Mailgun';s SDK和composer php?
我安装了一个用于服务的SDK。以下是我遵循的步骤:Centos 如何配置和使用Mailgun';s SDK和composer php?,centos,composer-php,mailgun,Centos,Composer Php,Mailgun,我安装了一个用于服务的SDK。以下是我遵循的步骤: # current directory cd ~ # Install Composer curl -sS https://getcomposer.org/installer | php # Add Mailgun as a dependency php composer.phar require mailgun/mailgun-php:~1.7 根据说明,之后我所做的就是(index.php): …我得到一个错误: 警告:require(
# current directory
cd ~
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Add Mailgun as a dependency
php composer.phar require mailgun/mailgun-php:~1.7
根据说明,之后我所做的就是(index.php):
…我得到一个错误:
警告:require(vendor/autoload.php):无法打开流:没有这样的
第2行/var/www/html/index.php中的文件或目录致命错误:
require():无法打开所需的“vendor/autoload.php”
(include_path='。:/usr/share/pear:/usr/share/php)在
/var/www/html/index.php,第2行
所以我猜这可能与composer的安装/配置有关?感谢您的帮助……按照您的编程方式,您必须将以下文件全部放在同一目录中:
composer.json
index.php (your test script)
您必须在该目录中运行composer require
命令。这还将在此处创建名为vendor
的目录,并添加大量文件,其中包括vendor/autoload.php
但是,如果您的测试脚本不在这个位置,那么
require
调用将找不到您告诉PHP查找它的文件。这不是Composer的任何失败,只是您必须根据自己的情况而不是通过复制粘贴代码来包含该文件。如果更改测试脚本的路径,还必须更改供应商目录的路径。感谢您的提示,第一次使用Composer。几秒钟后我会按照你的步骤做。不过,有一个简单的问题,当我运行composer require cmd时,composer.json文件是自动生成的吗?
$data = $mg->get("$domain/bounces", array('limit' => 15, 'skip' => 0));
var_dump($data);
composer.json
index.php (your test script)