質問編集履歴

2

全角のスペースを半角に変更しました。

2018/05/24 07:56

投稿

KengoKakeshita
KengoKakeshita

スコア6

test CHANGED
File without changes
test CHANGED
@@ -5,6 +5,8 @@
5
5
  PHPを学び始めて2か月目のビギナーです。
6
6
 
7
7
  説明すら覚束ない可能性がありますがよろしくお願いします。
8
+
9
+ PHPで前回のログイン日時を出力する機能を実装したいのですが動きません。
8
10
 
9
11
 
10
12
 
@@ -24,7 +26,7 @@
24
26
 
25
27
  <body>
26
28
 
27
- <?php
29
+ <?php
28
30
 
29
31
  // 「現在日時」「前回アクセスした日時」「これまでアクセスした回数」を表示する
30
32
 
@@ -34,11 +36,11 @@
34
36
 
35
37
  if ( !isset($_COOKIE['visit_count']) ) {
36
38
 
37
- // cookieを設定
39
+ // cookieを設定
38
40
 
39
41
  setcookie('visit_count', 1);
40
42
 
41
-  setcookie('visit_history',$now_date);
43
+ setcookie('visit_history',$now_date);
42
44
 
43
45
  print("初めてのアクセスです<br>");
44
46
 
@@ -52,7 +54,7 @@
52
54
 
53
55
  $count = $_COOKIE['visit_count'] + 1;
54
56
 
55
-  $visit_history = $_COOKIE['visit_history'];
57
+ $visit_history = $_COOKIE['visit_history'];
56
58
 
57
59
  setcookie('visit_count', $count);
58
60
 
@@ -60,13 +62,13 @@
60
62
 
61
63
  print("現在の日時は".$now_date."<br>");
62
64
 
63
-  print("前回のアクセス日時は".$visit_history."<br>");
65
+ print("前回のアクセス日時は".$visit_history."<br>");
64
66
 
65
67
  }
66
68
 
67
- ?>
69
+ ?>
68
70
 
69
- <input type="submit" name="delete" value="履歴削除">
71
+ <input type="submit" name="delete" value="履歴削除">
70
72
 
71
73
  </body>
72
74
 

1

コメントアウトの削除

2018/05/24 07:56

投稿

KengoKakeshita
KengoKakeshita

スコア6

test CHANGED
File without changes
test CHANGED
@@ -38,7 +38,7 @@
38
38
 
39
39
  setcookie('visit_count', 1);
40
40
 
41
- // setcookie('visit_history',$now_date);
41
+  setcookie('visit_history',$now_date);
42
42
 
43
43
  print("初めてのアクセスです<br>");
44
44
 
@@ -52,7 +52,7 @@
52
52
 
53
53
  $count = $_COOKIE['visit_count'] + 1;
54
54
 
55
- // $visit_history = $_COOKIE['visit_history'];
55
+  $visit_history = $_COOKIE['visit_history'];
56
56
 
57
57
  setcookie('visit_count', $count);
58
58
 
@@ -60,7 +60,7 @@
60
60
 
61
61
  print("現在の日時は".$now_date."<br>");
62
62
 
63
- // print("前回のアクセス日時は".$visit_history."<br>");
63
+  print("前回のアクセス日時は".$visit_history."<br>");
64
64
 
65
65
  }
66
66