<?php
$file=fopen("welcome.php","r");
$file=fread("welcome.php",4096);
?>
<!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>
File webcome.php is:<br />
<?php echo $file;?>
</body>
</html>提示错误:Warning: fread(): supplied argument is not a valid stream resource in D:\WEB\APMServ5.2.6\www\htdocs\form.php on line 4
File webcome.php is:
$file=fopen("welcome.php","r");
$file=fread("welcome.php",4096);
?>
<!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>
File webcome.php is:<br />
<?php echo $file;?>
</body>
</html>提示错误:Warning: fread(): supplied argument is not a valid stream resource in D:\WEB\APMServ5.2.6\www\htdocs\form.php on line 4
File webcome.php is:
$file=fopen("welcome.php","r");
$file=fread("welcome.php",4096);
?>
你查一下 fread的传入参数 应该是一个文件句柄
<?php
$file=fopen("welcome.php","r");
$code=fread($file,4096);
?>
<!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>
File webcome.php is:<br />
<?php echo htmlspecialchars($code);?>
</body>
</html>遇到不懂的函数多查查手册
还是刚才那错误,没解决我记得我这电脑安装DEDECMS编辑模板都能用啊,怎么现在没用啊
<?php
$fileName = 'welcome.php';
$file=fopen($fileName,"r");
$content=fread($file,4096);
?>
<!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>
File webcome.php is:<br />
<?php echo $content;?>
</body>
</html>
不给分宰你了!!!