我是 php 新手。我有一个 foreach 循环,用于检查票并将此票数据输出到谷歌电子表格中,另一个 foreach 循环存储旧票 id,但我需要将新票 id 与旧票 id 数组进行比较,如果存在则删除它并添加新的工单数据。我在比较旧票号和新票号 1 时遇到问题,请告知如何做到这一点。谢谢
foreach ($result->tickets as $ticket)
{
// For each for old ticket id's
foreach ($result->tickets as $oldticket)
{
$oldid = $oldticket->id;
}
$row = array
(
"Ticket ID" => $ticket->id,
"Ticket Title" => $ticket->title,
"Created On" => $month_created_on,
"Solved On" => $solved_on ,
"Status" => $ticket->status,
"Time Spent" => $ticket->time_spent,
"Assigned To" => $ticket->assigned_to->full_name,
"Mojo Number" => $ticket->assigned_to->mojo_number
);
if ($ticket->id == $oldid){
$ss->deleteRow($row);
}
$ss->addRow($row);
return $row;
}
提前致谢。