...
  $file   = "TwoMax Inter test templet,author:Sheyi";
 $fp= fopen ("temp.html","r");
^^这里是全角空格

解决方案 »

  1.   

    符号的 输入问题 占了 syntax error, unexpected T_VARIABLE 的很大成分...很大的成分...
      

  2.   

    <?php$dir_test = dirname(__FILE__);echo "$dir_test";$title = "PHP爱好者测试模板";
    $file = "TwoMax Inter test templet,author:Sheyi";
    $fp= fopen ("temp.html","r");
    $content = fread ($fp,filesize ("temp.html"));
    $content .= str_replace ("{ file }",$file,$content);
    $content .= str_replace ("{ title }",$title,$content);
    echo $content;?>小弟8月13 号 12:15分测试了一下...temp.html文件的内容为:csdn效果显示为:
    C:\Discuz!EXP\wwwrootcsdn csdn csdn csdnC:\Discuz!EXP\wwwroot 为小弟机器的 apache 里的一个目录.....
      

  3.   

    谢谢!直到错误了,呵呵!但是总是生成不成功!不知道什么原因麻烦看看!我都没有分数了,以后补上。谢谢!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <?
        $title = "PHP爱好者测试模板";
        $file   = "TwoMax Inter test templet,author:Sheyi";
    $h=fopen("2.html","r");
    $content=fread($h,filesize("2.html"));
        $content.=str_replace("{file}",$file,$content);
        $content.=str_replace("{title}",$title,$content);
        $filename = "test.html";
        $handle=fopen($filename,"w");//打开文件指针,创建文件    if (!is_writable($filename)){ 
              die ("文件:".$filename."不可写,请检查其属性后重试!");
        }
        if (!fwrite ($handle,$content)){  //将信息写入文件
             die ("生成文件".$filename."失败!");
        } 
        fclose ($handle); //关闭指针
      
        die ("创建文件".$filename."成功!");?>
    </body>
    </html>