だから私は、無料のウェブホスティングサーバ上twilioをテストしてきたし、これは私が得るものです:Twilio PHPの致命的なエラー
Fatal error: Class 'Twilio\Rest\Api' not found in /home/u512189195/public_html/twilio-php-master/Twilio/Rest/Client.php on line 263
は、これは私のコードです:
<?php
// Require the bundled autoload file - the path may need to change
// based on where you downloaded and unzipped the SDK
require __DIR__ . '/twilio-php-master/Twilio/autoload.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 = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$token = 'your_auth_token';
$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
'+15558675309',
array(
// A Twilio phone number you purchased at twilio.com/console
'from' => '+15017250604',
// the body of the text message you'd like to send
'body' => "Hey Jenny! Good luck on the bar exam!"
)
);
?>
私はしましたまた除外して試しました__DIR__ .
明らかに、私は自分のデータで変数を置き換えました。
twilioのドキュメントのWebサイトから入手したphpマスターライブラリをアップロードしました。 - https://www.twilio.com/docs/libraries/php
スクリプトには、これらのクラスをロードするオートロード機能がありません。自動ロードを使用するか、これらのスクリプトをすべてスクリプトに手動で含めることができます。 – Jer
@ c0dekid自動ロードを使用するにはどうすればよいですか? –