我必须构建一个数组作为以下从 $_POST 超全局收集值的数组。ca_objets 值将从变量中收集,点后的部分是我需要从 $_POST 收集的值。
$va_body=array(
"bundles" => array(
"ca_objects.description" => array("convertCodesToDisplayText" => true),
"ca_objects.description" => array("convertCodesToDisplayText" => true),
"ca_object.representations.caption" => array("convertCodesToDisplayText" => true)
)
);
这是我使用的代码:
<?php
$table="ca_objects";
$bund=$_POST['find_bundles']; //This is an array with the values I need.
$va_body=array("bundles" => array()); //I declare the array outside the foreach loop.
我不确定如何编写循环代码以填充 $va_body 数组中的“bundles”数组并获得我需要的结果。任何帮助将不胜感激。
foreach ($bund as $elem ) {
// code here
}
?>