我需要帮助。当有重复值时,我想删除数组列表中的数组。 我有这个数组
Array
(
[11] => Array
(
[0] => Array
(
[count] => 2
[price] => 1000
[total] => 2000
)
[1] => Array
(
[count] => 0
[price] => 124
[total] => 0
)
[2] => Array
(
[count] => 0
[price] => 2345
[total] => 0
)
)
[12] => Array
(
[0] => Array
(
[count] => 0
[price] => 1000
[total] => 0
)
[1] => Array
(
[count] => 1
[price] => 124
[total] => 124
)
[2] => Array
(
[count] => 0
[price] => 2345
[total] => 0
)
)
)
您可能会注意到价格键上存在重复值。但是如果计数等于0,我只想删除数组。但是如果重复的价格没有计数值。它只删除一个重复的数组。我的预期输出将是这样的。
$.ajax({
async: false,
type: "POST",
url: path + "/LogUserActivity",
data: "{ 'timeSpent': '" + Math.floor(diff / 1000).toString() + "', 'urlVisited': '" + path + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function () {
},
error: function (xhr, status, error) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
},
failure: function () {
}
});
请帮助谢谢。