Commit 47a58436 authored by Kbida Vincent's avatar Kbida Vincent
parents 8bdf3814 c3ab995f
<?php
use bdd\controleur\ControleurRequete;
use Illuminate\Database\Capsule\Manager as DB;
$db = new DB();
//SI CA NE FONCTIONNE PAS, ENLEVER LES COMMENTAIRES : CES INFOS SONT DEJA DANS LE CONF.INI
......@@ -30,10 +32,8 @@ $db->addConnection([
$db->setAsGlobal();
$db->bootEloquent();
// demerage d'un session
session_start();
// intance de slim qui a pour but de créer le rootage des urls
$app = new Slim();
$app->get('/', function () {
......@@ -41,15 +41,19 @@ $app->get('/', function () {
$v->renderHome();
})->name('accueil');
$app->get('/ex1/requete1', function () {
$c = new ControleurRequete();
$c->selectMario();
})->name('ex1 requete 1');
$app->get('/ex1/requete2', function () {
$c = new ControleurRequete();
})->name('ex1 requete 2');
$app->get('/ex1/requete3', function () {
$c = new ControleurRequete();
})->name('ex1 requete 3');
$app->get('/ex1/requete4', function () {
$c = new ControleurRequete();
})->name('ex1 requete 4');
......
<?php
use Slim\Slim;
class Requete1
{
protected $tab, $app;
public function __construct($t)
{
$this->tab = $t;
$this->app = Slim::getInstance();
}
public function render($type)
{
switch ($type) {
case 1:
return $this->default();
break;
default:
return $this->notFound();
break;
}
}
private function notFound()
{
$res .= <<<RES
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
</head>
<body>
<p>data not found</p>
</body>
</html>
RES;
}
private function default()
{
$res .= <<<RES
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
</head>
<body>
RES;
foreach ($this->tab as $key => $value) {
$res .= <<<RES
$key:$value
RES;
}
$res .= <<<RES
</body>
</html>
RES;
return $res;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment