1

我试图在 PHP 中表示以下 Perl 行:

$msg="!<connect_nettapi>\cD";  # Message ends with CTRL+D

我通过套接字发送此字符串,接收 API 要求命令由CTRL+D字符终止。我一直在尝试使用:

$msg="!<connect_nettapi>" . chr(some_hex_code);  # Message ends with CTRL+D

提前致谢。

4

2 回答 2

1

它是 EOT 字符(传输结束)。它的 ASCII 值为 4。

于 2011-03-25T21:06:27.527 回答
0

如果你想跳过调用chr你可以在你的字符串中使用十六进制转义

$msg="!<connect_nettapi>\x04";  # Message ends with CTRL-D (hex 04)
于 2011-03-25T21:50:10.480 回答