无法使用PHP显示中文字符

时间:2017-03-08 15:47:55

标签: php

<!doctype html>
<html>
<head>
<title>ECharts Sample</title>
    <meta name="robots" content="noindex" />
    <script src="/cc/echarts/js/echarts.bar.pie.legend.tooltip.ie8.uglify.min.js"></script>
</head>
<body>
    <div id="container" style="width: 100%;height:400px;"></div>
<script type="text/javascript">
var dom = document.getElementById("container");
var myChart = echarts.init(dom);
var app = {};
option = null;
app.title = 'test';

option = {
    color: ['#5b92d3','#c5def6', '#000099', '#2ab9da', '#bdbec0', '#b9c54a'],
    tooltip: {
        trigger: 'item',
        formatter: "{a} <br/>{b}"
    },
    legend: {
        orient: 'vertical',
        x: 'center',
        bottom: '0%',
        data:[/*'Europa: 54 %', 'Amerika: 20 %', 'Asien/\nPazifik: 17 %', 'Mittlerer Osten,\nAfrika & Sonstige: 9%',*/      'Medizintechnik: 65%', 'Sicherheitstechnik: 35%']
    },
    series: [
        {
            name:'Anteil nach Unternehmensbereichen',
            type:'pie',
            selectedMode: 'single',
            radius: ['20%', '30%'],
            label: {
                normal: {
                    show: false,
                    position: 'inner',
                    textStyle: {
                        color: 'rgba(84, 89, 92, 1)'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            itemStyle: {
                normal: {
                    shadowBlur: 0,
                    borderColor: '#fff',
                    borderWidth: 1,
                    borderType: 'solid'
                }
            },
            data:[
                {value:65, name:'Medizintechnik: 65%'/*, selected:true*/},
                {value:35, name:'Sicherheitstechnik: 35%'}
            ]
        },
        {
            name:'Umsatz im Geschaeftsjahr 2015: 2,6 Mrd. EUR',
            type:'pie',
            selectedMode: 'single',
            radius: ['45%', '55%'],
            label: {
                normal: {
                    textStyle: {
                        color: 'rgba(84, 89, 92, 1)'
                    }
                }
            },
            labelLine: {
                normal: {
                    lineStyle: {
                        color: 'rgba(84, 89, 92, 1)'
                    }
                }
            },
            itemStyle: {
                normal: {
                    shadowBlur: 0,
                    borderColor: '#fff',
                    borderWidth: 1,
                    borderType: 'solid'
                }
            },          
            data:[
                {value:54, name:'Europa: 54 %'},
                {value:20, name:'Amerika: 20 %'},
                {value:17, name:'Asien/\nPazifik: 17 %'},
                {value:9, name:'Mittlerer Osten,\nAfrika & Sonstige: 9%'}
            ]
        }
    ]
};

if (option && typeof option === "object") {
    myChart.setOption(option, true);
}
</script>
    <script src="/js/awesomeiframe.min.js"></script>
</body>
</html>

我有一个utf-8的数据库,我使用下面的PHP代码,它没有显示中文字符。我尝试过使用其他ODBC客户端,连接到相同的odbc数据源,并且能够显示汉字我试过这里提到的建议但是我仍然无法显示中文字符

1 个答案:

答案 0 :(得分:0)

这不是一个PHP问题。 将其添加到HTML

的head标记中
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />