我在PHP中有来自两个不同表的两个foreach,如何捕获所有参数并将其发送给其他函数?

时间:2018-12-17 14:03:00

标签: php yii

我想用两个不同表中的日期将参数发送给其他函数,但我不明白,我是Yii1和PHP的新手,没有结果,这里是一个示例尝试:

public function newTicket($id){
  $ticket = Ticket::model()->findByPk($id); 

  $user = User::model()->findAllByAttributes(array('roleID'=>2));

  foreach ($user as $us && $ticket as $tk) {
     $email= $us->email; 
     $name = $us->name;
     $subject = $tk->subject;
     $body= 'New Ticket'
     **Notification::sendNotifTicket($subject, $email, $name, $body);**
  }
}

带有两个foreach的另一个示例:

  $body= 'New ticket'
  foreach ($user as $us) {
     $email= $us->email; 
     $name = $us->name;
     foreach ($ticket as $tk) {
        $subject = $tk->subject;
        Notification::sendNotifTicket($subject, $email, $name, $body);
      }
  }

首先感谢:)

0 个答案:

没有答案