自述文件.md
使用 PHP MySql Bootstrap 4 的簡(jiǎn)單 CRUD
僅使用 PHP 進(jìn)行簡(jiǎn)單的用戶注冊(cè)
安裝
在數(shù)據(jù)庫(kù)中創(chuàng)建表:
create table usuario( id integer primary key AUTO_INCREMENT, nome varchar(200) not null, sobrenome varchar(300) not null, idade integer not null, sexo char(1) not null )
在“app/conexao”文件夾中配置 Conexao.php 文件:
在 getConex?o() 函數(shù)中添加以下代碼,如果您的數(shù)據(jù)庫(kù)是 Mysql,則它已經(jīng)是默認(rèn)的。
請(qǐng)記住根據(jù)您的銀行更改連接中的數(shù)據(jù)(數(shù)據(jù)庫(kù)名稱、用戶名、密碼)。
-連接到 MySql
if (!isset(self::$instance)) { self::$instance = new PDO('mysql:host=localhost;dbname=github', 'root', '', array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8")); self::$instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); self::$instance->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING); } return self::$instance;
-連接到 PostgreSql
$host = 'localhost;port=5432'; $dbname = 'github'; $user = 'root'; $pass = ''; try { if (!isset(self::$instance)) { self::$instance = new \PDO('pgsql:host='.$host.';dbname=' . $dbname . ';options=\'--client_encoding=UTF8\'', $user, $pass); self::$instance->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); self::$instance->setAttribute(\PDO::ATTR_ORACLE_NULLS, \PDO::NULL_EMPTY_STRING); } return self::$instance; } catch (Exception $ex) { echo $ex.'<br>'; }
制作人員
布雷揚(yáng)·蒙泰羅
電子郵件:brayanmonteirooo@gmail.com
索引.php
include_once "./app/conexao/Conexao.php";
include_once "./app/dao/UsuarioDAO.php";
include_once "./app/model/Usuario.php";
//實(shí)例化類(lèi)
$user = new User();
$usuariodao = new UsuarioDAO();
?>
CRUD 簡(jiǎn)單 PHP
.菜單,
頭{
背景顏色:#bbb !重要;
}
內(nèi)邊距:10px;
}
風(fēng)格>
}
風(fēng)格>
<身體>
CRUD PHP POO