Home >Backend Development >PHP Tutorial >When programming php socket, after an error is reported, the error content is garbled? ?

When programming php socket, after an error is reported, the error content is garbled? ?

WBOY
WBOYOriginal
2016-09-21 14:12:551530browse

php socket programming, when an error occurs, the error message is garbled:

<code>来自客户端 PHP 的消息: hello boy错误等级:2
错误消息:socket_write(): unable to write to socket [10057]: �����׽���û����Ӳ���(��ʹ��һ�� sendto ���÷�����ݱ��׽���ʱ)û���ṩ��ַ�����ͻ������ݵ�����û�б����ܡ� 
错误文件:D:\web\frontToolLib\php\socket_server.php
错误行数:88
错误代码: 10057
文字说明: 由于套接字没有连接并且(当使用一个 sendto 调用发送数据报套接字时)没有提供地址,发送或接收数据的请求没有被接受。

</code>

I tried switching the encoding (mb_convert_encoding) to utf-8, gbk, gb2312, iso-8859-1, etc., but it still failed to display normally. How can I display the error message normally? ?

Reply content:

php socket programming, when an error occurs, the error message is garbled:

<code>来自客户端 PHP 的消息: hello boy错误等级:2
错误消息:socket_write(): unable to write to socket [10057]: �����׽���û����Ӳ���(��ʹ��һ�� sendto ���÷�����ݱ��׽���ʱ)û���ṩ��ַ�����ͻ������ݵ�����û�б����ܡ� 
错误文件:D:\web\frontToolLib\php\socket_server.php
错误行数:88
错误代码: 10057
文字说明: 由于套接字没有连接并且(当使用一个 sendto 调用发送数据报套接字时)没有提供地址,发送或接收数据的请求没有被接受。

</code>

I tried switching the encoding (mb_convert_encoding) to utf-8, gbk, gb2312, iso-8859-1, etc., but it still failed to display normally. How can I display the error message normally? ?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn