json编码数组返回空

时间:2014-02-11 09:15:06

标签: php arrays json

您好我有一个我正在使用的数组示例。

Array ( [0] => Array ( ) [1] => Array ( ) [volumes_show] => Array ( [0] => 0.1-2.5μl [1] => 0.1-3μl [2] => 0.5-10μl [3] => 0.5-10μl [4] => 0.5-10μl [5] => 0.5-10μl [6] => 10-100μl [7] => 10-100μl [8] => 100-1000μl [9] => 100-1000μl [10] => 2-20μl [11] => 2-20μl [12] => 20-200μl [13] => 20-200μl [14] => 30-300μl [15] => 5-100μl [16] => 5-50μl [17] => 5-50μl [18] => 50-300μl ) [models_show] => Array ( [0] => mLine [1] => Proline ) ) 

我使用了json_encode并返回此值。

[[]]

我仍然想弄清楚什么是错的。非常感谢任何帮助。提前谢谢。

这是php

$data = array();
    $data['models_show'] = array();
    $data['volumes_show'] = array();    
    $data = array($data['models_show'],$data['models_show']);
    $brand = $_GET['Bname'];
    $data['volumes_show'] =$volumes[$brand];
    $data['models_show'] =$models[$brand];
    sort($data['volumes_show']);
    echo json_encode(array_unique($data));

以下是值:

$brands= array('Biohit','Brand','Eppendorf','Thermo/Finn','Gilson','Nichiryo','Rainin','Socorex');
$models = array('Biohit' => array('mLine','Proline'));
    $volumes = array( 'Biohit' => array('0.1-3μl','0.5-10μl','2-20μl','10-100μl','20-200μl','100-1000μl','0.5-10μl','5-100μl','30-300μl','0.1-2.5μl','0.5-10μl','2-20μl','5-50μl','10-100μl','20-200μl','100-1000μl','0.5-10μl','5-50μl','50-300μl'),'Brand' => array('0.1-1μl','0.5-10μl','2-20μl micro','2-20μl','5-50μl','10-100μl','20-200μl','100-1000μl','0.5-10μl','2-20μl','2.5-25μl','5-50μl','10-100μl','20-200μl','30-300μl','0.1-1μl','0.1-2.5μl','0.5-10μl','2-20μl','10-100μl','20-200μl','100-1000μl','0.5-10μl','5-50μl','10-100μl','20-200μl'),'Eppendorf' => array('10-100μl','30-300μl','0.1-2.5μl','0.5-10μl','2-20μl micro','50-200μl','100-1000μl'),'Thermo/Finn' => array(),'Gilson' => array(),'Nichiryo' => array(),'Rainin' => array(),'Socorex' => array() );    

1 个答案:

答案 0 :(得分:-1)

μ字符未正确写入。您必须使用其html实体编码字符更改代码中的所有μ个字符:

μ

数组示例:

array('0.1-3μl');

检查Unicode Character 'GREEK SMALL LETTER MU'