値をループし、配列にプッシュし、json に変換する PHP の foreach について助けが必要です。
次のコードは、最後の値のみを表示します。たとえば、表示される制限を超えるメールを 2 つ以上したい。私を助けてください。
public executeInvite(sfWebRequest $request)
{
$email = $request->getParameter("email");
foreach($email as $e)
{
if($invitationlimit>0)
{
$q = Doctrine_Query::create()
->from ('invitationwp')
->where('email_address = ?', $em);
$this->invitedlist = $q->fetchArray();
$message ="success";
}
else
{
$emails = array();
$count = 0;
$emails[$count++] =$em;
$message = $emails;
}
$invitationlimit--;
}
return $this->renderText(json_encode($message));
}