многомерный массив в yii - PullRequest
       9

многомерный массив в yii

0 голосов
/ 28 декабря 2011

sendmail.php Это всего лишь пример приложения, в котором я запутался ...

class sendmail()
        public $ATTACHMENT  = array();
public function MailSend()
{
        $message                = new YiiMailMessage;
        $message->subject       = $this->SUBJECT;
        $message->from      = $this->FROM;
        $message->setBody($this->EMAILBODY, 'text/html','utf-8');
        $message->addTo($this->EMAILTO);
        if (count($this->ATTACHMENT) > 0)
                    {
                        foreach ($this->ATTACHMENT as $Attachement_Array)
                        {
                            if (isset($Attachement_Array['filepath']) && $Attachement_Array['filename'] && $Attachement_Array['mimetype'] && file_exists($Attachement_Array['filepath']))
                            {
                                $message->attach(Swift_Attachment::fromPath($Attachement_Array['filepath']), $Attachement_Array['filename'], $Attachement_Array['mimetype']);
                            }
                        }
                    }
}
}

mycontroller.php

здесь, в $ SendMail-> ATTACHMENT = array («что здесь передать»);
пожалуйста, объясните мне я хочу многомерный массив filepath, mimetype, filename

 /** SEND EMAIL USING COMMON EMAIL FUNCTIONALITY */
    $SendMail               = new SendMail;
    $SendMail->DRAFT_ID     = $id;
    $SendMail->SUBJECT      = $modelEmail->subject;
    $SendMail->FROM         = $modelEmail->email_from;
    $SendMail->CMPAIGN_ID   = 1;
    $SendMail->TAG_ARRAY    = array("[FIRSTNAME]"=>$profiledata->name,"[EMAIL]"=>$profiledata->email,"[CONTACT_NO]"=>$profiledata->contact_no,"[ADDRESS]"=>$profiledata->address,"[WEBSITE]"=>$profiledata->website);
$SendMail->EMAILTO      = $profiledata->name."<".$profiledata->email.">";
$SendMail->ATTACHMENT   = array('filepath'=>Yii::app()->params['var_path']."stationary.html"); /// what to write here... i want multidimension array here

$SendMail->MailSend();
/** SEND EMAIL USING COMMON EMAIL FUNCTIONALITY */ 

1 Ответ

0 голосов
/ 29 декабря 2011

мой ответ

    $attach1                = array();
    $attach2                = array();
    $attach1                = array('filepath'=>Yii::app()->params['var_path']."stationary.html",
                                   'filename'=>"stationary.html",
                                    'mimetype'=>"application/html",);
    $attach2                = array('filepath'=>Yii::app()->params['var_path']."pregmatch1_old.php",
                                    'filename'=>"pregmatch1_old.php",
                                    'mimetype'=>"application/php",);
$SendMail->ATTACHMENT   = array($attach1,$attach2);
...