Because the domestic MySQL resources are relatively tense, foreign is not too slow, is not open to our users. Therefore, in the days without MySQL, we want to do something convenient for others and improve their site, it is more difficult than the sky, in order to get rid of this pain, niky crying meditation, behind closed doors, finally, Emperor, a simple message that does not need MySQL database support, this has been introduced, Let's call it gbook.php, the source program is as follows:
if ($message)
{
$message = ereg_replace ("Rnrn", "N
", $message);
Remove invalid control symbols
$date = Date ("L, F J Y, h:i a"); Gets the specified date time format
$ip =getenv ("remote_addr");
$message = "
$name |
$email |
Written in--$date |
From >> $ip |
$subject |
$massage |
";
$fp = fopen (basename ($PHP _self). ". Comment", "a");
Fwrite ($fp, $message);
Fclose ($FP);
}
@readfile (basename ($PHP _self. ". Comment")));
Read the contents of the record file
?>
──────────────────────────────────────
The above program, the principle is: on the PHP side first to determine whether the message variable exists, if not exist, read the file. The read file uses the ReadFile function. As for the file name extraction, here is a clever way to extract the absolute position of the file using the $php_self variable, and then use the basename () function to extract the filename, plus the specified end of the file comment.) to complete it. In order to better learn php&mysql, special take to share with you, but also hope that once and niky as painful as the network can have a message of their own, rather than "XXX message this is provided by xxx.com." and blot. What are you waiting for, hurry up and ACT!
All rights reserved, please do not reprint freely!
copyright©2000 Niky All rights reserved.
"The copyright of this article is owned by the author and house Orso near net, if need to reprint, please specify the author and source"
http://www.bkjia.com/PHPjc/316565.html www.bkjia.com true http://www.bkjia.com/PHPjc/316565.html techarticle because the domestic MySQL resources are relatively tense, foreign is not too slow, is not open to our users. Therefore, in the absence of MySQL days, we want to do some convenient others and improve their site ...