如何将创建的php excel附加到另一个函数

时间:2017-03-27 08:25:39

标签: php codeigniter phpexcel

我需要将gerenrated PHPExcel输出传递给将通过电子邮件发送的函数。我目前的代码是:

        $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); 
    $objWriter->save('php://output');
    //Send Email here 

    $this->ciEngine->load->library( 'Services\Notifications\PushReports\Survey\Email' );
    $emailResult = $this->ciEngine->Email->emailSurvey();

**更新 我添加了emailSurvey的代码供参考。

namespace Services\Notifications\PushReports\Survey;

use \Services\ServiceBase;

class Email
    extends ServiceBase
{
    public function emailSurvey( $countryConfig, $appointment )
    {
    if( empty( $appointment ) ) {
        return false;
    }

    $this->ciEngine->load->library( 'email' );
        $receipient     = $this->ciEngine->config->config['push-report-receipient'];
        $sender = $this->ciEngine->config->config['push-report-sender'];


    if( !empty($receipient) && !empty($sender) ){
    $this->ciEngine->email->initialize( $this->ciEngine->config->config );
    $this->ciEngine->email->from( $sender );
    $this->ciEngine->email->to( $receipient );

    $this->ciEngine->email->subject( $this->ciEngine->config->config['push-report-subject'] );
    ob_start();
    $this->ciEngine->load->view( 'emails/surveyPush' );
    $mailBody = ob_get_contents();
    ob_end_clean();
    $this->ciEngine->email->message( $mailBody );
    return $this->ciEngine->email->send();
    }
}

}

我怎样才能将它传递给emailSurvey功能?

0 个答案:

没有答案