2017-08-03 65 views
0

如果我有這樣的輸出數組:正從字符串數組中的蛋糕PHP值

$array_to_delete = 
[ 
    (int) 3 => (int) 4, 
    (int) 4 => (int) 5 
] 

,我想拿到4和5等在那裏的條件,像:

$warehouseItemsData = $this->WarehouseEmployers->WarehouseItems->find() 
    ->where(['id', $array_to_delete]) 
    ->all(); 

我該怎麼做?在蛋糕的PHP

+0

的可能的複製(https://stackoverflow.com/questions/6819865/cakephp-how-to-get [CakePHP中如何通過ID的陣列獲得多行] -id-array-of-id) – ksjohn

回答

1

使用IN

$warehouseItemsData = $this->WarehouseEmployers->WarehouseItems->find() 
    ->where(['id IN', $array_to_delete]) 
    ->all(); 
+0

謝謝你的工作 –