简体   繁体   English

为什么回声nbsp会有所作为? (PHP)

[英]Why would echoing an nbsp make a difference? (PHP)

I have a script which opens a file then prints its contents (for a long, silly reason that doesn't bear explaining). 我有一个脚本,它将打开一个文件,然后打印其内容(出于一个很长的愚蠢的原因,无需解释)。 The issue i have is, it often refuses to work, unless i echo some other text first. 我的问题是,除非我先回声一些其他文字,否则它通常会拒绝工作。 The code below doesn't work, but if i put echo "a"; 下面的代码不起作用,但是如果我把echo "a"; or echo " "; echo " "; first, it does. 首先,是的。 Even more strange, echo " "; 更奇怪的是, echo " "; is insufficient. 不足。

What does echoing some text do? 回显某些文本有什么作用?

//...a bunch of code to get the file name
if(file_exists($file))
    {
        $fp=fopen($file, "r");
        $temp = fread( $fp, filesize($file));
        echo $temp;
    } 
else 
    { 
    echo $file." not found<br /><br />";
    }
$filelen = @readfile($file);
if ($filelen===FALSE) {
    echo "{$file} not found <br /><br />";
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM