回答編集履歴

3

追記

2018/02/21 03:51

投稿

yambejp
yambejp

スコア114968

test CHANGED
@@ -31,3 +31,33 @@
31
31
  ```
32
32
 
33
33
  ※typo修正
34
+
35
+ # こまかく検証
36
+
37
+ ```PHP
38
+
39
+ $path='/storage/logs/articles/';
40
+
41
+ $file=$path.$id.'.log';
42
+
43
+
44
+
45
+ if(!file_exists($path)){
46
+
47
+ print "dir not exists";
48
+
49
+ }elseif(!is_dir($path)){
50
+
51
+ print "not directory";
52
+
53
+ }elseif(file_exists($file)){
54
+
55
+ print "file exists";
56
+
57
+ }else{
58
+
59
+ touch($file);
60
+
61
+ }
62
+
63
+ ```

2

修正

2018/02/21 03:51

投稿

yambejp
yambejp

スコア114968

test CHANGED
@@ -6,7 +6,15 @@
6
6
 
7
7
  $path='/storage/logs/articles/';
8
8
 
9
+ /*
10
+
11
+ ご指摘頂いたとおり修正します
12
+
9
- $file.=$id.'.log';
13
+ × $file.=$id.'.log';
14
+
15
+ */
16
+
17
+ $file=$path.$id.'.log';
10
18
 
11
19
 
12
20
 

1

修正

2018/02/21 03:32

投稿

yambejp
yambejp

スコア114968

test CHANGED
@@ -6,13 +6,13 @@
6
6
 
7
7
  $path='/storage/logs/articles/';
8
8
 
9
- $file.=$id'.log';
9
+ $file.=$id.'.log';
10
10
 
11
11
 
12
12
 
13
13
  if(file_exists($path) and is_dir($path)){
14
14
 
15
- if(!file_exists($file){
15
+ if(!file_exists($file)){
16
16
 
17
17
  touch($file);
18
18
 
@@ -21,3 +21,5 @@
21
21
  }
22
22
 
23
23
  ```
24
+
25
+ ※typo修正