在 laravel 中找不到类 'Twilio\Twiml'

use Twilio\Twiml;


public function welcome(Request $request)

    {

        $twiml = new Twiml();

        if(isset($request->Digits)){

            switch($request->Digits){

                case 1:

                    $twiml->say('thank you calling us');

                    break;

                default:

                    $twiml->say('You have entered wrong key');

                    break;

            }

        } else{

            $gather = $twiml->gather(array('numDigits' => 1));

            $gather->say('Thank you for calling us. Press 1 to continue the call.');

        }


        return $twiml;

    }

当我运行这段代码时,我收到一个错误,指出找不到类 Twlio/Twiml。更多详细信息,您可以查看错误的截图网址(https://prnt.sc/ryz1zw)。提前致谢。


芜湖不芜
浏览 37回答 1
1回答

拉丁的传说

TwiML 不是一个类,您需要VoiceResponse使用say().require_once './vendor/autoload.php';use Twilio\TwiML\VoiceResponse;$response = new VoiceResponse();$response->say('Chapeau!', ['voice' => 'woman', 'language' => 'fr-FR']);更多关于他们的文档。
打开App,查看更多内容
随时随地看视频慕课网APP