php var_dump()不显示非英文字符

问题描述:

我现在正在处理日文项目。当我使用var_dump()日语字符在浏览器中显示不正确。但英文字符正确显示。我该如何解决这个问题。我的var_dump()结果的下面部分,php var_dump()不显示非英文字符

'id' => int 71680 
    'customer_id' => int 16161 
    'amount' => string '1' (length=1) 
    'second_customer_id' => null 
    'second_amount' => null 
    'customer_name' => string '飛知和 啓一' (length=18) 
    'second_customer_name' => null 
    'payment_flag' => string '掛' (length=3) 
    'payment_flag_id' => int 2 
    'order_id' => int 9108 
    'article_name' => string '祭壇' (length=6) 
    'article_id' => int 1000001 
    'sales_price' => string '200000.0' (length=8) 
    'discount' => int 0 
    'ceremony_cooking_category_id' => null 
    'payment_date' => string '2014/12/05' (length=10) 
    'payment_hour' => string '0' (length=1) 
    'payment_min' => string '0' (length=1) 
    'hall_id' => null 
    'hall_name' => null 
    'hall_address' => null 
    'hall_tel' => null 
    'stock_date' => null 
    'stock_confirm_emps_name' => null 
    'check_date' => null 
    'check_emps_name' => null 
    'note' => string 'memo 333' (length=8) 
    'label' => string 'label 333' (length=9) 
+0

,你可以在这里发表您的头为好,如果你是混淆你需要告诉喜来使用UTF-8,如果你不这样做,这将有问题 – user2860957

+0

@ user2860957你是什​​么意思?你的意思是HTML标签? 你能解释我吗? –

+0

我可能是错误的,因为var转储不返回一个东西,但我想使用头,并告诉它使用utf-8可以帮助你,而我的意思是HTML头像'

' – user2860957

var_dump前添加

Header("Content-Type:text/html;charset=utf8"); 

,改变utf8到编码数据库中使用。

使用Content-Type: text/plaincharset=utf-8,这会强制输出呈现为纯文本。

在输出任何内容之前添加此行。

header("Content-Type: text/plain; charset=utf-8"); 

参考:Charset W3