Javascript foreach循环和获取codeigniter中循环的值
我有一个foreach循环,循环获取filename、alt和caption的值 控制器Javascript foreach循环和获取codeigniter中循环的值,javascript,php,jquery,arrays,codeigniter,Javascript,Php,Jquery,Arrays,Codeigniter,我有一个foreach循环,循环获取filename、alt和caption的值 控制器 public function save_product(){ log_message('debug', '['.__CLASS__.']['.__FUNCTION__.'][start]'); $this->load->helper('form'); //Grab all elements of the form with a name
public function save_product(){
log_message('debug', '['.__CLASS__.']['.__FUNCTION__.'][start]');
$this->load->helper('form');
//Grab all elements of the form with a name attribute
$post = $this->input->post(NULL, TRUE);
//$key refer to the $this->input->post('item_id');
//$value refer to the value of the post key
foreach($post as $key=> $value)
{
//retrieve the $key that start with 'images_files'
if (0 === strpos($key, 'images_files'))
{
log_message('debug', '['.__CLASS__.']['.__FUNCTION__.']['.$key.']['.print_r($value,TRUE).']');
var_dump($value);
echo "</br>";
}
elseif(0 === strpos($key, 'images_alt'))
{
log_message('debug', '['.__CLASS__.']['.__FUNCTION__.']['.$key.']['.print_r($value,TRUE).']');
var_dump($value);
echo "</br>";
}
elseif(0 === strpos($key, 'images_caption'))
{
log_message('debug', '['.__CLASS__.']['.__FUNCTION__.']['.$key.']['.print_r($value,TRUE).']');
var_dump($value);
echo "</br>";
/*array_push($images,
array(
,,$value)
);*/
}
}
//var_dump($images);
$item_id = $this->input->post('item_id');
$category_id = $this->input->post('category_id');
$item_info = $this->input->post('information');
$oldcolor_id = $this->input->post('oldcolor_id');
$color_id = $this->input->post('color_id');
if ($color_id == "")
{
$color_id = $oldcolor_id;
}
else
{
$color_id = $color_id;
}
$isClearance = $this->input->post('isClearance');
$parent_item_id = $this->input->post('parent_item_id');
$model_no = $this->input->post('model_no');
$volume = $this->input->post('volume');
$short_desc = $this->input->post('short');
$long_desc = $this->input->post('long');
$release_from = $this->input->post('from');
$release_to = $this->input->post('to');
$this->load->model('backend_product_model');
$this->backend_product_model->product_update($item_id, $category_id, $item_info, $color_id, $isClearance, $parent_item_id, $model_no, $volume, $short_desc, $long_desc, $release_from, $release_to);
}
我如何才能只获取“875fb89e3d00a78e177a0ad4ab0c2fde.jpg”、“alt 1”和“caption 1”,以便与其他“post”信息一起传递给product_update()函数?查看数组推送函数“images_files”,“images\u alt”和“images\u caption”字段的全名?显示
后端产品模型->产品更新()的代码。
查看数组推送函数“images\u files”、“images\u alt”和“images\u caption”字段的全名?显示后端产品模型->产品更新()的代码。
array(1) { ["4548736020191"]=> array(1) { ["filename"]=> string(36) "875fb89e3d00a78e177a0ad4ab0c2fde.jpg" } }
array(1) { ["4548736020191"]=> array(1) { ["alt"]=> string(5) "alt 1" } }
array(1) { ["4548736020191"]=> array(1) { ["caption"]=> string(9) "caption 1" } }