我在表單中使用多維數組,並且我想將這些值解析爲序列化數組以存儲在我的數據庫中。這裏是我的HTML表格的相關部分:將關聯POST數據輸入轉換爲序列化數組
<select name="week_days[monday]"><option value=""></option><option value="preferred">Preferred</option><option value="restricted">Restricted</option></select>
<select name="week_days[tuesday]"><option value=""></option><option value="preferred">Preferred</option><option value="restricted">Restricted</option></select>
<select name="week_days[wednesday]"><option value=""></option><option value="preferred">Preferred</option><option value="restricted">Restricted</option></select>
<select name="week_days[thursday]"><option value=""></option><option value="preferred">Preferred</option><option value="restricted">Restricted</option></select>
我想然後在我的模型中創建一個名爲week_days的數組。什麼我想要的陣列看起來像一個例子是這樣的:
array('monday'=>'preferred','tuesday'=>'','wednesday'=>'restricted','thursday'=>'');
我會再序列化()這個數組存儲在我的數據庫。如何將多維數組輸入轉換爲序列化數組?
這不是一個多維數組。它是一個簡單的關聯一個rray ..? –