我願推動本:推陣列到另一個陣列PHP
"serialNumber" => $serial,
$ postArray的內部產品陣列和
"note" => array(
"text" => $note
),
reservationDate在$ postArray之前。
$postArray = array(
"reservationDate" => $timeData,
"emailLanguageCode" => "it_it",
"shipToCode" => $_POST['ship'],
"customer" => array(
"firstName" => $_POST['firstName'],
"lastName" => $_POST['lastName'],
"emailId" => $_POST['emailId'],
"phoneNumber" => $_POST['phoneNumber'],
"address" => array(
"addressLine1" => $_POST['addressLine1'],
"city" => $_POST['city'],
"state" => $_POST['state'],
"country" => $_POST['country'],
"postalCode" => $_POST['postalCode']
)
),
"product" => array(
"productCode" => $_POST['productCode'],
"issueReported" => $_POST['issueReported']
)
);
,並導致我想:
$postArray = array(
"note" => array(
"text" => $note
),
"reservationDate" => $timeData,
"emailLanguageCode" => "it_it",
"shipToCode" => $_POST['ship'],
"customer" => array(
"firstName" => $_POST['firstName'],
"lastName" => $_POST['lastName'],
"emailId" => $_POST['emailId'],
"phoneNumber" => $_POST['phoneNumber'],
"address" => array(
"addressLine1" => $_POST['addressLine1'],
"city" => $_POST['city'],
"state" => $_POST['state'],
"country" => $_POST['country'],
"postalCode" => $_POST['postalCode']
)
),
"product" => array(
"serialNumber" => $serial,
"productCode" => $_POST['productCode'],
"issueReported" => $_POST['issueReported']
)
);
我嘗試這樣做:
array_push($postArray["product"][],$numeroSerie);
請幫助。
https://secure.php.net/array_unshift –