Php 致命错误:类';服务业';找不到

Php 致命错误:类';服务业';找不到,php,twilio,Php,Twilio,当使用Twilio的测试帐户提交表单时,我试图发送一条文本消息,但我收到以下错误:“致命错误:类”Services_Twilio“not found” 我的代码如下: } else{ //PHP native mail( $to_guest, $subject, $html_text, $header_guest); // Outlet Admin notification email mail( $to_admin, $subje

当使用Twilio的测试帐户提交表单时,我试图发送一条文本消息,但我收到以下错误:“致命错误:类”Services_Twilio“not found”

我的代码如下:

} else{
        //PHP native
        mail( $to_guest, $subject, $html_text, $header_guest);
        // Outlet Admin notification email
        mail( $to_admin, $subject, $notification_text, $header_admin);

/* Send an SMS using Twilio. You can run this file 3 different ways:
     *
     * - Save it as sendnotifications.php and at the command line, run 
     *        php sendnotifications.php
     *
     * - Upload it to a web host and load mywebhost.com/sendnotifications.php 
     *   in a web browser.
     * - Download a local server like WAMP, MAMP or XAMPP. Point the web root 
     *   directory to the folder containing this file, and load 
     *   localhost:8888/sendnotifications.php in a web browser.
     */

    // Step 1: Download the Twilio-PHP library from twilio.com/docs/libraries, 
    // and move it into the folder containing this file.
    require ('http://xzenweb.co.uk/reservation/web/twilio-php/Services/Twilio.php');

    // Step 2: set our AccountSid and AuthToken from www.twilio.com/user/account
    $AccountSid = "";
    $AuthToken = "";

    // Step 3: instantiate a new Twilio Rest Client
    $client = new Services_Twilio($AccountSid, $AuthToken);

    // Step 4: make an array of people we know, to send them a message. 
    // Feel free to change/add your own phone number and name here.
    $people = array(
        "+44463463241" => "Andrew Charlton",
    );

    // Step 5: Loop over all our friends. $number is a phone number above, and 
    // $name is the name next to it
    foreach ($people as $number => $name) {

        $sms = $client->account->messages->sendMessage(

        // Step 6: Change the 'From' number below to be a valid Twilio number 
        // that you've purchased, or the (deprecated) Sandbox number
            "YYY-YYY-YYYY", 

            // the number we are sending to - Any phone number
            +44463463241,

            // the sms body
            "Hey $name, Monkey Party at 6PM. Bring Bananas!"
        );

        // Display a confirmation message on the screen
        echo "Sent message to $name";
    }


    }
我已将我的帐户ID和authtoken从上面删除


有什么问题

所以您使用
require
。 根据和,其中一个请求打开一个文件并计算其背后的代码。 它的使用方式如下:从中获取文件(which根本不返回任何内容)和evals id(evals nothing)。 这就是你的要求失败的原因

如果您想要要求/包含这段coe,您应该从下载源代码并将其放在您的代码环境中

位如果我理解正确的话,它们被用作rest Web服务。 根据文献
您希望下载rest客户机代码(如本文所述),然后就可以下载所有代码;-)

感谢这一点,我已经在服务子目录下安装了php,但是我仍然收到错误消息。您是否修复了需要的路径?需要(DIR.'/my/path/twilio-php/Services/twilio.php')?您需要调整路径,但从这个示例开始,您应该能够完成它。DIR应该在前面和后面有两个下划线。。。就像这里描述的: