質問編集履歴

2

変更

2021/02/04 08:29

投稿

ykkk
ykkk

スコア91

test CHANGED
File without changes
test CHANGED
@@ -68,11 +68,9 @@
68
68
 
69
69
  $test3 = mb_convert_encoding("$test2", "SJIS-win");
70
70
 
71
- fwrite($test1, $test3);
71
+ if($test_date[0] < $out_year || $test_date[1] <= $out_month){
72
72
 
73
- if($test_date[0] = $out_year && $test_date[1] > $out_month){
73
+ fwrite($test1, $test3);
74
-
75
- break;
76
74
 
77
75
  }
78
76
 

1

変更

2021/02/04 08:28

投稿

ykkk
ykkk

スコア91

test CHANGED
File without changes
test CHANGED
@@ -16,19 +16,17 @@
16
16
 
17
17
  $test = storage_path('app/public/study05.csv');
18
18
 
19
- $fp = fopen($test, 'r');
19
+ $pf = fopen($test, 'r');
20
20
 
21
21
  $test1 = fopen('test.csv', 'w');
22
22
 
23
- if ($fp === false) {
23
+ if ($pf === false) {
24
24
 
25
25
  echo "ファイルオープン時に失敗したので処理終了します。" . PHP_EOL;
26
26
 
27
27
  exit;
28
28
 
29
29
  }
30
-
31
-
32
30
 
33
31
 
34
32
 
@@ -40,13 +38,9 @@
40
38
 
41
39
  $i = 0;
42
40
 
43
- $line1 = fgets($fp);
44
41
 
45
42
 
46
-
47
-
48
-
49
- while ($line1) {
43
+ while ($line1 = fgets($pf)) {
50
44
 
51
45
  $i++;
52
46
 
@@ -70,7 +64,7 @@
70
64
 
71
65
 
72
66
 
73
- $test2 = $test_field[0].','.$test_field[1].','.$test_field[2]."\n";
67
+ $test2 = $test_field[0].','.$test_field[1].','.$test_field[2];
74
68
 
75
69
  $test3 = mb_convert_encoding("$test2", "SJIS-win");
76
70
 
@@ -84,15 +78,11 @@
84
78
 
85
79
 
86
80
 
87
-
81
+ }
88
82
 
89
- fclose($fp);
83
+ fclose($pf);
90
84
 
91
- fclose($test1);
85
+ fclose($test1);
92
-
93
-
94
-
95
- }
96
86
 
97
87
  ```
98
88