abcd-1990.appspot.com
Vào 00:37:24 UTC+7 Thứ Hai, ngày 20 tháng 4 năm 2015, Bảo Nguyên đã viết:
>
> run guestbook localhost good.
> but upload app engine error can't open file.
> code:
> <html>
> <head><title>My Guestbook</title></head>
> <body>
> <h1>Welcome to My Guestbook</h1>
> <h2>Please write me a little note below</h2>
> <form action="" method="POST">
> <input type="text" name="user" placeholder="Name" />
> <br />
> <textarea cols="40" rows="5" name="note" placeholder="Comments"
> wrap="virtual"></textarea>
> <br />
> <input type="submit" name="submit" value="Submit" />
> </form>
> <?php
>
> if (isset($_POST['submit'])){
>
> $user = $_POST['user'];
> $note = $_POST['note'];
>
> if(!empty($user) && !empty($note)) {
> $msg = $user . ' : ' . $note;
> //will open a file
> $fp = fopen("notes.txt","a") or die("Can't open file");
> //will write to a file
> fwrite($fp, $msg."\n");
> fclose($fp);
> }
> }
> ?>
>
> <h2>The entries so far:</h2>
> <?php
> $file = fopen("notes.txt", "r") or exit("Unable to open file!");
> //Output a line of the file until the end is reached
> while(!feof($file))
> {
> //will return each line with a break
> echo fgets($file). '<br />';
> }
> fclose($file);
> ?>
> </body>
> </html>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/2f036444-5452-4595-b0f1-07407b2e7cb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.