質問編集履歴
2
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -20,6 +20,8 @@
|
|
20
20
|
```PHP
|
21
21
|
[test.php]
|
22
22
|
<?php
|
23
|
+
ini_set('error_reporting', E_ALL | E_STRICT); ←追記
|
24
|
+
ini_set('display_errors', 1); ←追記
|
23
25
|
namespace User\Status;
|
24
26
|
|
25
27
|
require_once $_SERVER['DOCUMENT_ROOT'] . '\test\AutoLoad\AutoLoad.php';
|
1
ソースコードの追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -42,6 +42,45 @@
|
|
42
42
|
|
43
43
|
```
|
44
44
|
|
45
|
+
```PHP
|
46
|
+
[AutoLoad.php]
|
47
|
+
<?php
|
48
|
+
|
49
|
+
namespace test\AutoLoad;
|
50
|
+
|
51
|
+
class AutoLoad
|
52
|
+
{
|
53
|
+
|
54
|
+
protected $dirs;
|
55
|
+
|
56
|
+
public function register()
|
57
|
+
{
|
58
|
+
spl_autoload_register(array(
|
59
|
+
$this,
|
60
|
+
'loadClass'
|
61
|
+
));
|
62
|
+
}
|
63
|
+
|
64
|
+
public function registerDir($dir)
|
65
|
+
{
|
66
|
+
$this->dirs[] = $dir;
|
67
|
+
}
|
68
|
+
|
69
|
+
public function loadClass($class)
|
70
|
+
{
|
71
|
+
foreach ($this->dirs as $dir) {
|
72
|
+
$file = $dir . '/' . $class . '.php';
|
73
|
+
if (is_readable($file)) {
|
74
|
+
require $file;
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
|
+
?>
|
81
|
+
|
82
|
+
```
|
83
|
+
|
45
84
|
### 試したこと
|
46
85
|
|
47
86
|
他の場所(AutoLoad等)で発生しているのかなと思い、コメントアウトして1行ずつ確認しましたが、
|