質問編集履歴
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -5,3 +5,59 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
namespace、class名を変更しろ!!の突っ込みはなしでお願いします。
|
8
|
+
|
9
|
+
```PHP
|
10
|
+
|
11
|
+
//■Test1.php
|
12
|
+
|
13
|
+
class TestClass {
|
14
|
+
|
15
|
+
function test() {
|
16
|
+
|
17
|
+
echo "test1";
|
18
|
+
|
19
|
+
}
|
20
|
+
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
//■Test2.php
|
28
|
+
|
29
|
+
class TestClass {
|
30
|
+
|
31
|
+
function test() {
|
32
|
+
|
33
|
+
echo "test2";
|
34
|
+
|
35
|
+
}
|
36
|
+
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
//■処理(下記みたいに処理をしたときにエラーにならないようにできる??)
|
44
|
+
|
45
|
+
// Cannot declare class TestClass, because the name is already in use
|
46
|
+
|
47
|
+
require_once Test1.php;
|
48
|
+
|
49
|
+
//※アンロード処理
|
50
|
+
|
51
|
+
require_once Test2.php;
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
$obj = new TestClass();
|
56
|
+
|
57
|
+
$obj->test(); // ここでtest2を出す
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
```
|