中找到類「客戶端」我在將Twilio SMS APi添加到我的網站時出錯。我的網站是在wordpress中使用Woo商業。致命錯誤:未在
錯誤:Fatal error: Class 'Client' not found in /var/www/html/++++/wp-content/themes/dokan-theme-v2.2.2-child/functions.php on line 4583
我的代碼如下:
function wl8OrderPlacedTriggerSomething($order_id){
//do something...
//echo get_stylesheet_directory_uri(). '/twilio-php-master/Twilio/Rest/Client.php';
require_once(get_stylesheet_directory_uri(). '/twilio-php-master/Twilio/autoload.php');
require(get_stylesheet_directory_uri(). '/twilio-php-master/Twilio/Rest/Client.php');
// Use the REST API Client to make requests to the Twilio REST API
// use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$sid = 'xxxxxxxxxxxxxxxxxxxxxx';
$token = 'xxxxxxxxxxxxxxxx';
$client = new 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 (xxxxxxx)
'xxxxxxxxx',
array(
// A Twilio phone number you purchased at twilio.com/console
'from' => '+xxxxxxx',
// the body of the text message you'd like to send
'body' => "Hey Jenny! Good luck on the bar exam!"
)
);
}
請幫我的一樣。
謝謝
非常感謝你的回覆,讓我檢查。 –
同樣的錯誤致命錯誤:在'/var/www/html/pdf=/dev/wp-content/themes/dokan-theme-v2.2.2-child/functions.php'中找不到類'Twilio \ Rest \ Client' line 4582 –
我已經用另一個想法更新了我的答案,看看它是否有效 – philnash