本帖最后由 wyf23256 于 2011-11-15 15:28:46 编辑

解决方案 »

  1.   

    你的$consignee_list就是你上面给的数组吗?
    除了{$consignee.province.region_name} 不显示 其它的有值吗?
      

  2.   

    其它都显示,毕竟foreach循环的是一个地址表
    省份字段那个在地址表里是数字,通过类解析对应省份
    如地址表省份字段值32,通过类getone_region解析到ID=32的为上海,通过foreach输出得到省份不是数字32,而是‘上海’这么说明白么?
      

  3.   

    明白 你的模板代码没有问题
    在于你的php代码的 foreach
        $consignee['province']     = getone_region($consignee['province']);
    你上面这一句 其实没有改到 $consignee_list 这个数组的具体内容
    应该是 $consignee_list[$key]['province'] = getone_region($consignee['province']);
    你在foreach 完 再 print_r($consignee_list);  看下结果 我说的对不对
      

  4.   

    $consignee_list[$key]['province'] = getone_region($consignee['province']);
      

  5.   

    Array ( [address_id] => 9 [address_name] => [user_id] => 382 [consignee] => 2323123 [email] => [email protected] [country] => 1 [province] => 25 [city] => 321 [district] => 2721 [address] => wqewqewq [zipcode] => 21 [tel] => 13487065213 [mobile] => [sign_building] => [best_time] => [0] => Array ( [province] => Array ( [region_name] => 上海 ) ) ) Array ( [address_id] => 11 [address_name] => [user_id] => 382 [consignee] => [email] => [country] => 1 [province] => 0 [city] => 0 [district] => 0 [address] => [zipcode] => [tel] => [mobile] => [sign_building] => [best_time] => [1] => Array ( [province] => Array ( ) ) ) Array ( [address_id] => 12 [address_name] => [user_id] => 382 [consignee] => 新天地电脑城 [email] => [email protected] [country] => 1 [province] => 13 [city] => 183 [district] => 1568 [address] => 新天地电脑城 [zipcode] => [tel] => 13487065213 [mobile] => [sign_building] => [best_time] => [2] => Array ( [province] => Array ( [region_name] => 湖北 ) ) ) Array ( [country] => 1 [email] => [city] => 0 [3] => Array ( [province] => Array ( ) ) ) 
    还是不行,怪的很
    模板调用出来的显示2  0  1,完整的省ID为25 0 13 感觉被截断了样另,我打印出来用 print_r($consignee['province']['region_name']);
    显示上海,湖北  说明没问题,问题调用到模板上就不行  怪的很楼上兄弟说的我也照做了,道理是有,但就是出不来效果,只好再劳烦各位
      

  6.   

     foreach ($consignee_list as $key => $consignee)
            {
                $consignee['country']  = isset($consignee['country'])  ? intval($consignee['country'])  : 0;
               // $consignee['province'] = isset($consignee['province']) ? intval($consignee['province']) : 0;
                $consignee['city']     = isset($consignee['city'])     ? intval($consignee['city'])     : 0;            $province_list[$region_id] = get_regions(1, $consignee['country']);
                $city_list[$region_id]     = get_regions(2, $consignee['province']);
               // $consignee['province']     = getone_region($consignee['province']);
    $consignee_list[$key]['province'] = getone_region($consignee['province']);
               // print_r($consignee);
                //exit;
                $district_list[$region_id] = get_regions(3, $consignee['city']);
            }print_r($consignee_list);这样 然后贴出你的结果