PHP readfile 将内容长度添加到输出 [英] PHP readfile adds content length to output

查看:43
本文介绍了PHP readfile 将内容长度添加到输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHP readfile 函数读取文件并像这样打印它:print readfile ('anyfile').这有效,但文件的内容长度也添加到字符串的末尾.为什么?

I am using the PHP readfile function to read a file and print it like so: print readfile ('anyfile'). This works, but the content length of the file is added at the end of the string also. Why?

推荐答案

readfile() 打印出内容本身并返回内容长度——您可以使用 readfile 有效地打印内容,然后使用 print<打印内容长度/代码>.删除打印并使用

readfile() prints out the contents itself and returns the content length -- you're effectively printing the contents with readfile and then printing the content length with print. Remove print and just use

readfile('anyfile');

这篇关于PHP readfile 将内容长度添加到输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆