Skip to content

Commit

Permalink
added: http response
Browse files Browse the repository at this point in the history
  • Loading branch information
sheron184 committed Mar 21, 2024
1 parent b3b1d51 commit 0d69e9a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Controllers;

use System\HttpResponse;
use System\Http;

abstract class Controller{
use HttpResponse;
}
use Http\HttpResponse;
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"psr-4": {
"App\\":"app",
"Config\\":"config",
"System\\": "system"
"System\\": "system",
"System\\Http": "system/http"
}
},
"require": {
Expand Down
Empty file added config/Cors.php
Empty file.
4 changes: 2 additions & 2 deletions system/HttpResponse.php → system/http/HttpResponse.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace System;
namespace System\Http;

trait HttpResponse
{
Expand All @@ -16,7 +16,7 @@ public function view($view): void
$dir = __DIR__;
http_response_code(200);
header("Content-Type: text/html");
$html = file_get_contents(__DIR__ . '/../app/Views/'.$view.'.php');
$html = file_get_contents(__DIR__ . '/../../app/Views/'.$view.'.php');
echo $html;
}
}

0 comments on commit 0d69e9a

Please sign in to comment.