Commit c7773d4c authored by 君塚 悠's avatar 君塚 悠

コメントを追記

parent 54da25f0
<!-- --> <!-- 書き込まれたゲストブックの内容を出力する。 -->
<html> <html>
<head> <head>
<title>ゲストブック</title> <title>ゲストブック</title>
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
<body> <body>
<h1 style="background: #cccccc">ゲストブック(閲覧)</h1> <h1 style="background: #cccccc">ゲストブック(閲覧)</h1>
<?php <?php
// ゲストブックに書き込まれた内容のファイルを開く
$file = fopen("guest.dat", "r"); $file = fopen("guest.dat", "r");
// ループで1つずつ読み込みながら表示させている
while ($row = fgetcsv($file, 104, "\t")) { while ($row = fgetcsv($file, 104, "\t")) {
?> ?>
<ol> <ol>
......
<!-- 書き込まれたゲストブックの内容を、最新のものから出力する。 -->
<html> <html>
<head> <head>
<title>ゲストブック</title> <title>ゲストブック</title>
......
<?php <?php
//ゲストブックの書き込みを、常に書き込み日時が降順になるようにする
//オリジナルファイルの読み込み //オリジナルファイルの読み込み
$org_file=fopen("guest.dat", "r"); $org_file=fopen("guest.dat", "r");
//tmpファイルの作成→新記書き込み→オリジナルファイル追記 //tmpファイルの作成→新記書き込み→オリジナルファイル追記
...@@ -8,7 +10,7 @@ $tmp_file=fopen("guest/tmp", "w"); ...@@ -8,7 +10,7 @@ $tmp_file=fopen("guest/tmp", "w");
flock($org_file,LOCK_EX); flock($org_file,LOCK_EX);
flock($tmp_file,LOCK_EX); flock($tmp_file,LOCK_EX);
//$line変数に書き込む文字列を連結していく。\tはタブ。 //$line変数に書き込む文字列を連結していく。\tはタブ
$line =date("Y年 m月 d日 H:i:s")."\t"; $line =date("Y年 m月 d日 H:i:s")."\t";
$line.=$_POST['name']."\t"; $line.=$_POST['name']."\t";
$line.=$_POST['message']."\t"; $line.=$_POST['message']."\t";
......
<?php <?php
//三角形の大きさから、面積を計算して返す //三角形の大きさから、面積を計算して返す
//Figureを継承しているため、ゲッター、セッター、get_area()は宣言済みの扱い //Figureを継承しているため、ゲッター、セッター、get_area()は宣言済みの扱いになる
class Triangle extends Figure class Triangle extends Figure
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment