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.
有没有办法获取函数读取的字节数?
使用函数**getrusage**我可以得到
**getrusage**
ru_inblock; /* block input operations */
但是如何获取函数读取的字节数?
你不能。您将需要预加载自己的 SO 来覆盖read(2)调用它并计算实际读取的字节数。
read(2)
使用strace(1)或调试器。您将不得不对输出进行一些后处理,但是有关系统调用传输的数据的所有信息都在那里。
strace(1)
我是 php 新手,我无法弄清楚如何将确切的字符串“ <?php”输出为 HTML 字符串、从文件(即file_get_contents(blah);)输出或echo "<?php";在代码段内输出。我认为它被解释为 php 代码段的开头,因为没有输出数据。任何帮助,将不胜感激。
<?php
file_get_contents(blah);
echo "<?php";