質問編集履歴
1
質問を入力せずに先ほど間違えて投稿しました。失礼しました。
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            ### phpで掲示板を作成勉強中です。教本にはboard.txtにテキストファイルにメッセージを保存とありますが、変数に代入しただけでテキストファイルが作成されているのでしょうか。
         | 
| 2 | 
            +
            ```ここに言語を入力
         | 
| 1 3 | 
             
            <!DOCTYPE html>
         | 
| 2 4 | 
             
            <html lang="en">
         | 
| 3 5 | 
             
            <head>
         | 
| @@ -30,4 +32,21 @@ | |
| 30 32 | 
             
            }
         | 
| 31 33 |  | 
| 32 34 |  | 
| 33 | 
            -
            ?> | 
| 35 | 
            +
            ?>
         | 
| 36 | 
            +
            <?php 
         | 
| 37 | 
            +
            $file = 'board.txt';
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            if(file_exists($file)){
         | 
| 40 | 
            +
                $board = json_decode(file_get_contents($file));
         | 
| 41 | 
            +
            }
         | 
| 42 | 
            +
            $board[]=$_REQUEST['message'];
         | 
| 43 | 
            +
            file_put_contents($file, json_encode($board));
         | 
| 44 | 
            +
            foreach($board as $message){
         | 
| 45 | 
            +
                echo '<p>' ,$message, '</p><hr>';
         | 
| 46 | 
            +
            }
         | 
| 47 | 
            +
             | 
| 48 | 
            +
             | 
| 49 | 
            +
            ?>
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            コード
         | 
| 52 | 
            +
            ```
         | 
