Degree '°' character not displaying in php json_encode function, how to display this?

后端 未结 4 1401
臣服心动
臣服心动 2021-02-19 21:59

I pass php array like

[sit_latitude] => 20° 23.298\' N

inside json_encode(); and output is like,

  {\"sit_latitude\":null}
<         


        
4条回答
  •  悲哀的现实
    2021-02-19 22:59

    what i tried and succeed was bit strange but worked , so let me share it with you.

    $latitude = json_encode(utf8_encode($emplyoee['sit_latitude']));
    $longitude = json_encode(utf8_encode($employee['sit_longitude']));
    
       $emplyoee['sit_latitude'] = $latitude;
        $emplyoee['sit_longitude'] = $longitude;
    

    and now pass like

    echo '{"item":'. json_encode($employee) .'}';
    

    this will solve your problem

提交回复
热议问题