Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP中的Perl CTRL-D等效项?_Php_Perl_Ctrl - Fatal编程技术网

PHP中的Perl CTRL-D等效项?

PHP中的Perl CTRL-D等效项?,php,perl,ctrl,Php,Perl,Ctrl,我试图用PHP表示以下Perl行: $msg="!<connect_nettapi>\cD"; # Message ends with CTRL+D $msg=“!\cD”#消息以CTRL+D结尾 我通过套接字发送这个字符串,接收API要求命令以CTRL+D字符终止。我一直在尝试使用: $msg="!<connect_nettapi>" . chr(some_hex_code); # Message ends with CTRL+D $msg=“!”。chr(一

我试图用PHP表示以下Perl行:

$msg="!<connect_nettapi>\cD";  # Message ends with CTRL+D
$msg=“!\cD”#消息以CTRL+D结尾
我通过套接字发送这个字符串,接收API要求命令以CTRL+D字符终止。我一直在尝试使用:

$msg="!<connect_nettapi>" . chr(some_hex_code);  # Message ends with CTRL+D
$msg=“!”。chr(一些十六进制代码);#消息以CTRL+D结尾
提前感谢。

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

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

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

$msg="!<connect_nettapi>\x04";  # Message ends with CTRL-D (hex 04)
$msg=“!\x04”#消息以CTRL-D(十六进制04)结尾

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

$msg="!<connect_nettapi>\x04";  # Message ends with CTRL-D (hex 04)
$msg=“!\x04”#消息以CTRL-D(十六进制04)结尾