Home >Backend Development >PHP Tutorial >PHP socket出现乱码解决方案

PHP socket出现乱码解决方案

WBOY
WBOYOriginal
2016-06-13 10:21:551226browse

PHP socket出现乱码
PHP这边作为客户端发起连接请求,代码如下:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);   $connection = socket_connect($socket, '192.168.8.216', 2012); $buffer = @socket_read($socket, 1024, PHP_NORMAL_READ); var_dump($buffer);

结果打印出来的是string '??c' (length=5)。这是怎么回事?

------解决方案--------------------
前面4个可能是一个数

你和他通讯都不约定的吗?
------解决方案--------------------
你还是用fsockopen吧
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