質問編集履歴
2
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -41,6 +41,10 @@
|
|
41
41
|
[test.php]
|
42
42
|
|
43
43
|
<?php
|
44
|
+
|
45
|
+
ini_set('error_reporting', E_ALL | E_STRICT); ←追記
|
46
|
+
|
47
|
+
ini_set('display_errors', 1); ←追記
|
44
48
|
|
45
49
|
namespace User\Status;
|
46
50
|
|
1
ソースコードの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -86,6 +86,84 @@
|
|
86
86
|
|
87
87
|
|
88
88
|
|
89
|
+
```PHP
|
90
|
+
|
91
|
+
[AutoLoad.php]
|
92
|
+
|
93
|
+
<?php
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
namespace test\AutoLoad;
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
class AutoLoad
|
102
|
+
|
103
|
+
{
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
protected $dirs;
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
public function register()
|
112
|
+
|
113
|
+
{
|
114
|
+
|
115
|
+
spl_autoload_register(array(
|
116
|
+
|
117
|
+
$this,
|
118
|
+
|
119
|
+
'loadClass'
|
120
|
+
|
121
|
+
));
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
public function registerDir($dir)
|
128
|
+
|
129
|
+
{
|
130
|
+
|
131
|
+
$this->dirs[] = $dir;
|
132
|
+
|
133
|
+
}
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
public function loadClass($class)
|
138
|
+
|
139
|
+
{
|
140
|
+
|
141
|
+
foreach ($this->dirs as $dir) {
|
142
|
+
|
143
|
+
$file = $dir . '/' . $class . '.php';
|
144
|
+
|
145
|
+
if (is_readable($file)) {
|
146
|
+
|
147
|
+
require $file;
|
148
|
+
|
149
|
+
return;
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
?>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
|
166
|
+
|
89
167
|
### 試したこと
|
90
168
|
|
91
169
|
|