这是我们的电子邮件通知中的代码。当用户更新个人资料管理员获取更新的特定字段的通知时。在表单中有更多100个字段。
我做了两个阵列。//updated array
$compare_array=array_diff_assoc($updated_meta_data,$previous_data);
//previous array
$pre_data=array_intersect_key($previous_data,$compare_array);
if(!empty($pre_data) || !empty($compare_array)) {
foreach ($compare_array as $key => $value) {
if(empty($value) && empty($pre_data[$key]))
continue;
$emailtext.="<tr>
<td style='border:2px; border-style: solid; border-collapse:collapse;'>$key</td>
<td style='border:2px; border-style: solid; border-collapse:collapse;'>{$pre_data[$key]}</td>
<td style='border:2px; border-style: solid; border-collapse:collapse;'>$value</td>
</tr>";
}
}
我的调试结果在
之下 ["fourth_guest_salutation"]=>
string(2) "Mr"
["fourth_guest_first_name"]=>
string(0) ""
["fourth_guest_last_name"]=>
string(0) ""
["fourth_guest_email"]=>
string(0) ""
["fourth_guest_country_code"]=>
string(10) "+91- India"
["fourth_guest_contact_number"]=>
string(0) ""
["fourth_guest_nationality"]=>
string(5) "India"
["fourth_guest_id_doc"]=>
string(0) ""
["fourth_guest_passport_picture_front"]=>
string(0) ""
["fourth_guest_passport_picture_back"]=>
string(0) ""
["fourth_guest_indian_visa"]=>
string(0) ""
["fourth_guest_has_travel_details_as_first_guest"]=>
string(2) "on"
["fourth_guest_visa_assistance"]=>
string(2) "on"
["fourth_guest_arrival_date"]=>
string(0) ""
["fourth_guest_name_of_airline"]=>
string(0) ""
["fourth_guest_flight_number"]=>
string(0) ""
["fourth_guest_city_of_departure"]=>
string(0) ""
["fourth_guest_arrival_time_of_flight"]=>
string(5) "00:00"
["fourth_guest_conn_arrival_time_flight"]=>
string(5) "00:00"
["fourth_guest_has_conn_flight"]=>
string(2) "on"
["fourth_guest_conn_city_of_departure"]=>
string(0) ""
table stricture are
column |previous data|updated data
below is my email result.
fourth_guest_arrival_time_of_flight, fourth_guest_conn_arrival_time_flight fields --- 是空白 但在 var_dump中,结果值为00:00 我的问题是如何解决空白问题?