zipusyan commited on
Commit
a1cf4c6
·
verified ·
1 Parent(s): 5aace46

Upload 2 files

Browse files
Files changed (1) hide show
  1. entrypoint.sh +41 -0
entrypoint.sh CHANGED
@@ -148,4 +148,45 @@ PHPEOF
148
  chown nginx:nginx /app/www/public/check.php 2>/dev/null || true
149
  echo "=== check.php created ==="
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  exec "$@"
 
148
  chown nginx:nginx /app/www/public/check.php 2>/dev/null || true
149
  echo "=== check.php created ==="
150
 
151
+ cat > /app/www/public/rtest.php <<'PHPEOF'
152
+ <?php
153
+ header('Content-Type: text/plain; charset=utf-8');
154
+ echo "=== Route Test ===\n\n";
155
+
156
+ // Back up original server vars
157
+ $orig = $_SERVER;
158
+
159
+ // Simulate /login request
160
+ $_SERVER['REQUEST_URI'] = '/login';
161
+ $_SERVER['REQUEST_METHOD'] = 'GET';
162
+ $_SERVER['SCRIPT_NAME'] = '/index.php';
163
+ $_SERVER['QUERY_STRING'] = '';
164
+ $_SERVER['HTTPS'] = 'off';
165
+ unset($_SERVER['argv']);
166
+
167
+ try {
168
+ require dirname(__DIR__) . '/vendor/autoload.php';
169
+ $app = new \think\App(dirname(__DIR__));
170
+ $app->debug = true;
171
+ $http = $app->http;
172
+ $response = $http->run();
173
+
174
+ echo "Response code: " . $response->getCode() . "\n";
175
+ echo "Response class: " . get_class($response) . "\n";
176
+ echo "Headers:\n";
177
+ foreach ($response->getHeader() as $k => $v) {
178
+ echo " $k: $v\n";
179
+ }
180
+ echo "Content (" . strlen($response->getContent()) . " bytes):\n";
181
+ echo $response->getContent() . "\n";
182
+ } catch (\Throwable $e) {
183
+ echo "EXCEPTION: " . get_class($e) . ": " . $e->getMessage() . "\n";
184
+ echo $e->getTraceAsString() . "\n";
185
+ }
186
+ // Restore
187
+ $_SERVER = $orig;
188
+ PHPEOF
189
+ chown nginx:nginx /app/www/public/rtest.php 2>/dev/null || true
190
+ echo "=== rtest.php created ==="
191
+
192
  exec "$@"