質問編集履歴
2
config/autoload.phpを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,6 +96,54 @@
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
+
```PHP
|
100
|
+
|
101
|
+
//vagrant/sns_php/config/autoload.php
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<?php
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
/*
|
110
|
+
|
111
|
+
MyApp
|
112
|
+
|
113
|
+
index.php controller
|
114
|
+
|
115
|
+
MyApp\Controller\Index
|
116
|
+
|
117
|
+
-> lib/Controller/Index.php
|
118
|
+
|
119
|
+
*/
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
spl_autoload_register(function($class) {
|
124
|
+
|
125
|
+
$prefix = 'MyApp\';
|
126
|
+
|
127
|
+
if (strpos($class, $prefix) === 0) {
|
128
|
+
|
129
|
+
$className = substr($class, strlen($prefix));
|
130
|
+
|
131
|
+
$classFilePath = __DIR__ . '/../lib/' . str_replace('\', '/', $className) . '.php';
|
132
|
+
|
133
|
+
if (file_exists($classFilePath)) {
|
134
|
+
|
135
|
+
require $classFilePath;
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
});
|
142
|
+
|
143
|
+
```
|
144
|
+
|
145
|
+
|
146
|
+
|
99
147
|
```
|
100
148
|
|
101
149
|
$ php -S 192.168.33.10:8000 -t public_html/
|
@@ -113,7 +161,3 @@
|
|
113
161
|
### 補足情報(FW/ツールのバージョンなど)
|
114
162
|
|
115
163
|
CyberDock、Atomを利用
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
ここにより詳細な情報を記載してください。
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,15 +64,33 @@
|
|
64
64
|
|
65
65
|
|
66
66
|
|
67
|
-
|
67
|
+
namespace MyApp\Controller;
|
68
68
|
|
69
69
|
|
70
70
|
|
71
|
-
|
71
|
+
class Index extends \MyApp\Controller {
|
72
72
|
|
73
73
|
|
74
74
|
|
75
|
-
|
75
|
+
public function run() {
|
76
|
+
|
77
|
+
if (!$this->isLoggedIn()) {
|
78
|
+
|
79
|
+
// login
|
80
|
+
|
81
|
+
header('Location: ' . SITE_URL . '/login.php');
|
82
|
+
|
83
|
+
exit;
|
84
|
+
|
85
|
+
}
|
86
|
+
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
}
|
92
|
+
|
93
|
+
|
76
94
|
|
77
95
|
```
|
78
96
|
|