Skip to content

Commit 42a533a

Browse files
committed
moved files
1 parent 9463feb commit 42a533a

File tree

23 files changed

+32
-7
lines changed

23 files changed

+32
-7
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

Controller/User.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
require_once __DIR__ . '/BaseController.php';
4+
5+
class User extends BaseController
6+
{
7+
public static function get()
8+
{
9+
json(reqVar('id'), 200);
10+
// render('index.php', array('title' => 'Index Page'));
11+
}
12+
13+
public static function post()
14+
{
15+
json('post user', 200);
16+
}
17+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Log
1515
*/
1616
public static function writeToLog($dateTime, $request): void
1717
{
18-
$data = '[' . $dateTime . ']' . $request;
18+
$data = '[' . $dateTime . '] ' . implode($request);
1919
$fp = fopen(__DIR__ . '/../Logs/server.log', 'a');
2020
fwrite($fp, $data);
2121
fclose($fp);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ function reqVar($key)
2626
*/
2727
function json($data, $statusCode): void
2828
{
29+
require_once __DIR__ . '/Log.php';
30+
Log::writeToLog(time(), $_SERVER);
2931
header('Content-Type: application/json; charset=utf-8');
3032
http_response_code($statusCode);
3133
echo json_encode($data);
@@ -39,6 +41,8 @@ function json($data, $statusCode): void
3941
*/
4042
function xml($data, $statusCode): void
4143
{
44+
require_once __DIR__ . '/Log.php';
45+
Log::writeToLog(time(), $_SERVER);
4246
$data = array($data);
4347
header('Content-Type: application/xml');
4448
http_response_code($statusCode);
@@ -56,6 +60,8 @@ function xml($data, $statusCode): void
5660
*/
5761
function render($view, $data = array()): void
5862
{
63+
require_once __DIR__ . '/Log.php';
64+
Log::writeToLog(time(), $_SERVER);
5965
if(count($data)) extract($data);
6066
require __DIR__ . '/../View/layout/' . $view;
6167
}

0 commit comments

Comments
 (0)