質問編集履歴

4

タイトル編集

2019/06/08 11:37

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- php require
1
+ 外部ファイルの変数参照 ~PHP~
test CHANGED
File without changes

3

エラーメッセージの追加

2019/06/08 11:37

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -18,6 +18,16 @@
18
18
 
19
19
 
20
20
 
21
+ index.view.phpにgreeting変数がないことは理解しています。
22
+
23
+ 変数を定義しているのはindex.phpです。
24
+
25
+
26
+
27
+
28
+
29
+
30
+
21
31
  ファイルの場所はhtdocs直下です。
22
32
 
23
33
  MAMP/htdocs
@@ -28,31 +38,7 @@
28
38
 
29
39
  ### 発生している問題・エラーメッセージ
30
40
 
31
- ページソース
32
-
33
- <!DOCTYPE html>
34
-
35
- <html lang="ja">
36
-
37
- <head>
38
-
39
- <meta charset="UTF-8">
40
-
41
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
41
+ Notice: Undefined variable: greeting in /Applications/MAMP/htdocs/index.view.php on line 13
42
-
43
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
44
-
45
- <title>Document</title>
46
-
47
- </head>
48
-
49
- <body>
50
-
51
- <h1></h1>
52
-
53
- </body>
54
-
55
- </html>
56
42
 
57
43
 
58
44
 

2

sourceを二つに分割

2019/06/08 11:34

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  LARACASTでPHPの講座を受講しています。
10
10
 
11
- 変数を同じディレクトリのファイル内で定義してもう一つのファイルでechoしようとしています。
11
+ index.phpで定義した変数をindex.view.phpで出力
12
12
 
13
13
  しかし、画面には何も表示されません。
14
14
 
@@ -92,7 +92,11 @@
92
92
 
93
93
 
94
94
 
95
+ ```
95
96
 
97
+
98
+
99
+ ```PHP
96
100
 
97
101
  ~index.php~
98
102
 
@@ -107,8 +111,6 @@
107
111
 
108
112
 
109
113
  require 'index.view.php';
110
-
111
-
112
114
 
113
115
 
114
116
 

1

試したこと追加

2019/06/08 11:29

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- MAMP php require
1
+ php require
test CHANGED
@@ -14,11 +14,17 @@
14
14
 
15
15
 
16
16
 
17
+ index.view.phpでechoはされます。
18
+
19
+
20
+
17
21
  ファイルの場所はhtdocs直下です。
18
22
 
19
23
  MAMP/htdocs
20
24
 
21
25
 
26
+
27
+ よろしくお願い致します。
22
28
 
23
29
  ### 発生している問題・エラーメッセージ
24
30
 
@@ -86,6 +92,8 @@
86
92
 
87
93
 
88
94
 
95
+
96
+
89
97
  ~index.php~
90
98
 
91
99
 
@@ -110,9 +118,13 @@
110
118
 
111
119
  ### 試したこと
112
120
 
113
- 下記のサイトでconf/apache/httpd.confを編集しました。
121
+ 1.下記のサイトでconf/apache/httpd.confを編集しました。
114
122
 
115
123
  https://qiita.com/FJHoshi/items/c5ff14c79b1ffd85cb14
124
+
125
+
126
+
127
+ 2.xamppでも同じ処理を実行したが表示されません。
116
128
 
117
129
 
118
130