Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

simple MVC REST API framework using PHP and mySql

License

NotificationsYou must be signed in to change notification settings

navnit-chauhan/MVC-REST-API-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Representational state transfer (REST) is a software architectural that seperates models, views and controller component and interconnectes them. it is a client-server architecture.

Project Overview

This project is created for getting simple knowledge of php with MVC framework.

Project includes PHP as a backend language and MySql database.

Project includes email Authentication and CRUD operation on different records.

Connecting to MySql using PHP

class Model {protected$connection ="";protected$servername="localhost";protected$username="root";protected$password="";// your mysql database passwordprotected$dbname="";// database name// connecting with databasefunction__construct() {mysqli_report(MYSQLI_REPORT_STRICT);try {$this->connection =newmysqli($this->servername,$this->username,$this->password,$this->dbname);        }catch(Exception$e) {echo"Connection to database is failed".$e->getMessage();exit;        }    }}

Calling Model components from Controller

require_once('Models/Model.php');session_start();class Controllerextends Model {function__construct() {parent::__construct();$baseDir =basename(__FILE__);$location =substr($_SERVER['PHP_SELF'],strpos($_SERVER['PHP_SELF'],$baseDir) +strlen($baseDir));if($location) {switch($location) {// cases ..                }            }    }}

About

simple MVC REST API framework using PHP and mySql

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp