projetAcoBDDv30.03.26
This commit is contained in:
53
projetphp/config/BDD.php
Normal file
53
projetphp/config/BDD.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
class BDD{
|
||||
|
||||
private static ?PDO $pdo=null;
|
||||
public const DB_NAME = 'siterecette';
|
||||
private static string $db_name=BDD::DB_NAME;
|
||||
|
||||
|
||||
public static function getPDO(){
|
||||
|
||||
if(self::$pdo==null){
|
||||
$db_host = "127.0.0.1" ; $db_port = "3306" ;
|
||||
// identifiant
|
||||
$db_user = "admin" ; $db_pwd = "adminpass123" ;
|
||||
|
||||
// connection a la database
|
||||
try{
|
||||
$dsn = 'mysql:dbname=' . self::$db_name . ';host='. $db_host. ';port=' . $db_port;
|
||||
$pdoo = new PDO($dsn, $db_user, $db_pwd);
|
||||
}
|
||||
|
||||
//erreur?
|
||||
catch (\Exception $ex){ ?>
|
||||
Code : <?= $ex->getCode() ?><br> Message : <?= $ex->getMessage() ?>
|
||||
<?php
|
||||
die("message d'arreet connexion stopee") ;}
|
||||
|
||||
self::$pdo = $pdoo;
|
||||
}
|
||||
return self::$pdo;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getname(){
|
||||
return self::$db_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
8
projetphp/config/general.php
Normal file
8
projetphp/config/general.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'website_url' => 'http://127.0.0.1:8080/',
|
||||
'website_name' => 'Les recettes des Papis',
|
||||
|
||||
'website_path' => APP_ROOT,
|
||||
];
|
||||
6
projetphp/config/route_arguments.php
Normal file
6
projetphp/config/route_arguments.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'{int}' => '([0-9]+)',
|
||||
'{chars}' => '([A-Za-z]+)',
|
||||
'{string}' => '([0-9A-Za-z]+)',
|
||||
];
|
||||
4
projetphp/config/views.php
Normal file
4
projetphp/config/views.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'base_view_skeleton' => 'base'
|
||||
];
|
||||
Reference in New Issue
Block a user