我一运行你的第一个文件,竟然出来这么多错误,你是让我们改错吗
<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>2</b><br />
<br />
<b>Warning</b>: fopen("", "r") - Inappropriate ioctl for device in <b>/home/yjj/public_html/test/index.php</b> on line <b>2</b><br />
<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>3</b><br />
<br />
<b>Warning</b>: stat failed for (errno=2 - No such file or directory) in <b>/home/yjj/public_html/test/index.php</b> on line <b>3</b><br />
<br />
<b>Warning</b>: fread(): supplied argument is not a valid File-Handle resource in <b>/home/yjj/public_html/test/index.php</b> on line <b>3</b><br />
<br />
<b>Warning</b>: fclose(): supplied argument is not a valid File-Handle resource in <b>/home/yjj/public_html/test/index.php</b> on line <b>4</b><br />
<html>
<head>
<title>编辑php文件代码</title>
</head>
<body bgcolor="fafad2">
您正在修改的文件是:
<font size=4 color="blue">
<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>14</b><br />
</font>
<center>
<form action="edit2.php" method="post">
<input type="hidden" name="filename" value="<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>18</b><br />
">
<textarea name="content" rows=22 cols=100> </textarea><br><br>
<input type="submit" value="保存">
<input type="button" value="返回" onclick="javascript:history.back();">
</form>
</center>
</body>
</html>
<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>2</b><br />
<br />
<b>Warning</b>: fopen("", "r") - Inappropriate ioctl for device in <b>/home/yjj/public_html/test/index.php</b> on line <b>2</b><br />
<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>3</b><br />
<br />
<b>Warning</b>: stat failed for (errno=2 - No such file or directory) in <b>/home/yjj/public_html/test/index.php</b> on line <b>3</b><br />
<br />
<b>Warning</b>: fread(): supplied argument is not a valid File-Handle resource in <b>/home/yjj/public_html/test/index.php</b> on line <b>3</b><br />
<br />
<b>Warning</b>: fclose(): supplied argument is not a valid File-Handle resource in <b>/home/yjj/public_html/test/index.php</b> on line <b>4</b><br />
<html>
<head>
<title>编辑php文件代码</title>
</head>
<body bgcolor="fafad2">
您正在修改的文件是:
<font size=4 color="blue">
<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>14</b><br />
</font>
<center>
<form action="edit2.php" method="post">
<input type="hidden" name="filename" value="<br />
<b>Notice</b>: Undefined variable: filename in <b>/home/yjj/public_html/test/index.php</b> on line <b>18</b><br />
">
<textarea name="content" rows=22 cols=100> </textarea><br><br>
<input type="submit" value="保存">
<input type="button" value="返回" onclick="javascript:history.back();">
</form>
</center>
</body>
</html>
<?php
$str = "<hr>";
print $str;
print htmlentities($str);
htmlentities()是什么函数啊,现在可以了,但是汉字却显示成乱码了
换成
$str=htmlspecialchars(fread($fp,filesize($filename)));或者:读的时候
$str=str_replace("</textarea>","[/textarea]",fread($fp,filesize($filename)));存的时候
$str=str_replace("[/textarea]","</textarea>",$willbe_save_filedata);
我是想在文本框里显示PHP文件代码,而现在的遇到的问题是汉字显示成了乱码。我该怎么做。