我正试图让twilio与我的网站一起发送短信。
以下是我所采取的步骤
首先,我下载了最新的回购程序,并将Twilio文件夹放在/libraries下
然后我又说
$config['composer_autoload'] = '/libraries/Twilio/autoload.php';到config/config.php
然后在我的控制器里,
我有个功能就是,
$number = 'xx';
$country = '1';
$to = '+'.$country.$number;
require(APPPATH . "/libraries/Twilio/autoload.php");
// Use the REST API Client to make requests to the Twilio REST API
// Your Account SID and Auth Token from twilio.com/console
$sid = "xx"; // Your Account SID from www.twilio.com/console
$token = "xx";
$client = new Twilio\Rest\Client($sid, $token);
// Use the client to do fun stuff like send text messages!
$client->messages->create(
// the number you'd like to send the message to
$to,
array(
// A Twilio phone number you purchased at twilio.com/console
'xxx' => 'ADD Your Free/purchased Number',
// the body of the text message you'd like to send
'body' => "Hey Emir! It's Works"
)
);所以我的问题是,当我运行视图时,这是我得到的错误,
遇到PHP错误 严重程度:警告 消息: require(/var/www/xxx.com/public_html/application/libraries/Twilio/Twilio/Rest/Client.php):未能打开流:没有这样的文件或目录
因此,出于某种原因,Twilio/autooload.php在路径中添加了另一个/Twilio,我无法理解它。
有什么帮助吗?
发布于 2018-01-10 12:40:36
// Get the PHP helper library from twilio.com/docs/php/install
require_once 'Full/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;
// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "AC5ef872f6da5a21de157d80997a64bd33";
$token = "your_auth_token";
$client = new Client($sid, $token);
$client->messages->create(
"+16518675309",
array(
'from' => "+14158141829",
'body' => "Tomorrow's forecast in Financial District, San Francisco is Clear.",
'mediaUrl' => "https://climacons.herokuapp.com/clear.png",
)
);https://stackoverflow.com/questions/44977165
复制相似问题