Home > Backend Development > PHP Tutorial > php在线文本编辑器_PHP

php在线文本编辑器_PHP

WBOY
Release: 2016-06-01 12:28:31
Original
4344 people have browsed it

作者leon0324





function write_file($filename,$contents)

{ if ($fp=fopen($filename,"w"))

{

fwrite
($fp,stripslashes($contents));

fclose
($fp);

return 1 ;

}

else {return 0; }

};

if ($submitbutton=="完成")

{ $rs=write_file("$page","$test");

echo "$page">$page

"
;

}

elseif ($action=="page")

{ $content="$page";

$fp
=fopen($content,"r") or die('Could not open file.');

$contents
=fread($fp,filesize($content)) or die('Could not read from file.');

$contents
=htmlspecialchars($contents);

fclose
($fp);

echo "

$PHP_SELF
?page=$page" method="post">";

echo ";

echo $contents;

echo "";

echo "submit" name="submitbutton" value="完成">";

echo "";

}

else

{ echo "
$PHP_SELF
?action=page" method="post">";

echo "";

echo "submit" name="send" value="选定">";

echo "";

}

?&g

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template