0
我有一個這樣的數組:PHP如何在數組中刪除數組?
$_SESSION = Array (
[chose_image] => Array (
[56915e7c48177e251e1c16f1] => Array (
[title] => title1
[author] => author1
[watermark] => watermark1
[file_name] => name1.jpg
[visible] => 1
[_id] => MongoId Object ([$id] => 56915e7c48177e251e1c16f1)
)
[56915dad48177ee21d1c16f0] => Array (
[title] => title2
[author] => author2
[watermark] => watermark2
[file_name] => name2.jpg
[visible] => 1
[_id] => MongoId Object ([$id] => 56915dad48177ee21d1c16f0)
)
)
)
而且我想刪除整個數組:
Array (
[56915e7c48177e251e1c16f1] => Array (
[title] => title1
[author] => author1
[watermark] => watermark1
[file_name] => name1.jpg
[visible] => 1
[_id] => MongoId Object ([$id] => 56915e7c48177e251e1c16f1)
使用[$ ID]。由$ id做到這一點非常重要,因爲數組是由用戶動態填充的。可能嗎?
這就是'未設置()由'爲 – Jordy
取消設置會刪除THW指數permently – devpro
兩種方式..一個是未設置的第二個是創建一個新的數組並忽略這一個 – devpro