Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
1
10php
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yu Kimiduka
10php
Commits
c7773d4c
Commit
c7773d4c
authored
Jul 26, 2016
by
君塚 悠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
コメントを追記
parent
54da25f0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
3 deletions
+8
-3
guest_read.php
php/php10/day05/guest_read.php
+3
-1
guest_read_r2.php
php/php10/day05/guest_read_r2.php
+1
-0
guest_write_r2.php
php/php10/day05/guest_write_r2.php
+3
-1
Triangle.class.php
php/php10/day10-2/Triangle.class.php
+1
-1
No files found.
php/php10/day05/guest_read.php
View file @
c7773d4c
<!-- -->
<!--
書き込まれたゲストブックの内容を出力する。
-->
<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>
...
...
php/php10/day05/guest_read_r2.php
View file @
c7773d4c
<!-- 書き込まれたゲストブックの内容を、最新のものから出力する。 -->
<html>
<html>
<head>
<head>
<title>
ゲストブック
</title>
<title>
ゲストブック
</title>
...
...
php/php10/day05/guest_write_r2.php
View file @
c7773d4c
<?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/php10/day10-2/Triangle.class.php
View file @
c7773d4c
<?php
<?php
//三角形の大きさから、面積を計算して返す
//三角形の大きさから、面積を計算して返す
//Figureを継承しているため、ゲッター、セッター、get_area()は宣言済みの扱い
//Figureを継承しているため、ゲッター、セッター、get_area()は宣言済みの扱い
になる
class
Triangle
extends
Figure
class
Triangle
extends
Figure
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment