0
我有一個創建像$ _POST變量的一種形式:轉換POST到多維數組
Array
(
[submit] => Update the List!
[12052,s] => 1
[12052,d] => 0
[12052,r] => 1
[11271,s] => 1
[11271,d] => 0
[11271,r] => 5
[16008,s] => 0
[16008,d] => 0
[16008,r] => 4
)
,我想用PHP將其轉換爲一個多維數組,如:
Array
(
[12052] => Array
(
[s] => 1
[d] => 0
[r] => 1
)
[11271] => Array
(
[s] => 1
[d] => 0
[r] => 5
)
[16008] => Array
(
[s] => 0
[d] => 0
[r] => 4
)
)
我知道我可以使用此代碼手動創建一個這樣的數組:
$test = array("12052" => array("s"=>"1","d"=>"0","r"=>"1"),"11271" => array("s"=>"1","d"=>"0","r"=>"5"),"16008" => array("s"=>"0","d"=>"0","r"=>"4"));
感謝您幫助我弄清楚t o儘可能地做到這一點!
偉大的作品!它沒有用's','d'和'r'鍵來設置嵌套項目,但它不是一個交易斷路器。 –
@JeffLange:啊,修正:https://eval.in/135859 - 很高興我能提供幫助。 –
優秀!再次感謝。 –