Php 调用Codeigniter中未定义的方法Sendgrid::send()

Php 调用Codeigniter中未定义的方法Sendgrid::send(),php,codeigniter,sendgrid,Php,Codeigniter,Sendgrid,我正在使用sendgrid api v3。使用核心php在本地服务器上一切正常,现在我使用codeigniter框架在服务器上移动代码。它显示了以下错误 致命错误:在第19行的/var/www/html/adihex/application/helpers/Sendgrid\u helper.php中调用未定义的方法Sendgrid::send() 这是我的密码 <?php require_once FCPATH . 'sendgrid-php/sendgrid-php.php'; fu

我正在使用sendgrid api v3。使用核心php在本地服务器上一切正常,现在我使用codeigniter框架在服务器上移动代码。它显示了以下错误

致命错误:在第19行的/var/www/html/adihex/application/helpers/Sendgrid\u helper.php中调用未定义的方法Sendgrid::send()

这是我的密码

<?php
require_once FCPATH . 'sendgrid-php/sendgrid-php.php';

function send_mail()
{
    $template_id = '********************************';
    $api_key = '*************************************';
    // echo '<pre>';
    $email = new \SendGrid\Mail\Mail();
    $email->setFrom("test@example.com", "Example User");
    $email->setSubject("Sending with Twilio SendGrid is Fun");
    $email->addTo("singhrobin1238014@gmail.com", "Example User");
    $email->setTemplateId($template_id);
    $email->addDynamicTemplateDatas([
        'heading'     => 'Welcome to Adihex',
    ]);
    $sendgrid = new \SendGrid($api_key);
    try {
        $response = $sendgrid->send($email);
        print $response->statusCode() . "\n";
        print_r($response->headers());
        print $response->body() . "\n";
    } catch (Exception $e) {
        echo 'Caught exception: ' . $e->getMessage() . "\n";
    }
}