Skip to content

Commit 346b2ef

Browse files
committed
update
1 parent c8d581c commit 346b2ef

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

app/Controller/IndexController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,14 @@ public function index($request, $response)
1717
{
1818
$response->end('Hello Simps.');
1919
}
20+
21+
public function test($request, $response, $data)
22+
{
23+
$response->end(json_encode($data));
24+
}
25+
26+
public function favicon($request, $response)
27+
{
28+
$response->end('');
29+
}
2030
}

config/routes.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@
1212
return [
1313
['GET', '/', '\App\Controller\IndexController@index'],
1414
['POST', '/', '\App\Controller\IndexController@index'],
15-
['GET', '/test/{id:\d+}', '\App\Controller\IndexController@index'],
15+
['GET', '/test/{id:\d+}', '\App\Controller\IndexController@test'],
16+
// ico应该使用enable_static_handler
17+
['GET', '/favicon.ico', '\App\Controller\IndexController@favicon'],
1618
];

0 commit comments

Comments
 (0)