Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图在 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
提前致谢。
它是 EOT 字符(传输结束)。它的 ASCII 值为 4。
如果你想跳过调用chr你可以在你的字符串中使用十六进制转义
chr
$msg="!<connect_nettapi>\x04"; # Message ends with CTRL-D (hex 04)