我对使用 ajax-jquery 将 php 数组发送到另一个 php 文件有疑问,如果我们使用某些输入类型隐藏值通过 jquery post 发送 php 数组,它将数组转换为字符串。所以另一个php文件没有作为数组值接收它作为字符串接收。我知道 php explode implode 功能。但是在codeiginter中,给定的数组不同,请参阅我需要发送的以下数组
Array ( [0] => stdClass Object ( [pro_id] => 1731 [pro_code] => 2564 [pro_name] => Lakudi [pro_des] => IS USED IN ALL FOOD SWEETNER INSTEAD OF SUGAR [pro_det_des] => ALSO AVAILABLE VARIES COLORS AND SHAPES CUBES BIG AND SMALL BALLS AND YELLOW, BROWN AND BLACK COLORS [pro_pack_des] => BULK AS WELL AS CONSUMER PACKING CAN BE OFFERED 30 KGS BULK ALSO AVAILABLE [pack_length] => 65 [pack_breadth] => 85 [pack_height] => 110 [cbm] => 0.608 [case_netweight] => 30 [case_grossweight] => 31 [price_INR] => 1100.00 [price_USD] => 0.00 [slab1] => [slab2] => [slab3] => [slab4] => [s1price] => [s2price] => [s3price] => [s4price] => [prolabel] => [exp_on] => 2013-12-31 [und_grp] => 16 [image_name] => 19442_94.jpg [image_name1] => 0 [image_name2] => 0 [image_name3] => 0 [crt_date] => 2013-06-11 [up_date] => 2013-06-11 [status] => active [admin_status] => deactive [list] => 0 [supplier_id] => 100 [bin] => 0 ) )
我使用输入类型隐藏示例代码发送了这个数组
<input type="hidden" class="datapro" value="<?php print_r($data)?>">
我的 jquery-ajax 代码
$('.clickfu').click(function(){
var view = $(this).attr('id');
var datapro = $('.datapro').val();
$.post('<?php echo base_url()?>productajax',{typ:'proview',view:view,datapro:datapro},function(data){
$(".prolist").replaceWith(data);
// alert(data);
});
return false;
})
在这个数组中。我如何使用explode implode函数将字符串转换为数组。所以请给我指导来解决这个问题。提前感谢