43 53 44 4e 28 77 77 77 2e 63 73 64 6e 2e 6e 65
74 29 ------解决方案-------------------- 老徐所写的定长指的是格式参数所需要的长度,而不是字符串(输入)的长度
例如手册的例子
Example #1 pack() example
$binarydata = pack("nvc*", 0x1234, 0x5678, 65, 66);
?>
The resulting binary string will be 6 bytes long and contain the byte sequence 0x12, 0x34, 0x78, 0x56, 0x41, 0x42.
因为参数n和v是16位,而c则是8位,所以后面几个参数0x1234按n参数,0x5678按v参数,65按c参数,*号表示后续继续按c参数,所以66也按c参数输出
换言之,格式参数中*号就能用于后面不定长的输入了
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