Code Monkey home page Code Monkey logo

shesheshe / build-your-own-php-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhoujiping/build-your-own-php-framework

0.0 1.0 0.0 26 KB

“论PHP框架是如何诞生的”文章的源码,从php最基础语法开始罗列,最终按照MVC的架构慢慢的编写出可以用于小项目的php框架,框架基于Laravel的**, 文章地址:

Home Page: http://www.zhoujiping.com/php/build-your-own-php-framework/

PHP 97.17% CSS 2.83%

build-your-own-php-framework's Introduction

论PHP框架是如何诞生的代码

文章地址: http://www.zhoujiping.com/php/build-your-own-php-framework/

分支说明及文章对应代码阅读说明

一共有5个分支:

     `the_first_refactoring` -  对应文章中目录: 第一次代码重构
     `the_second_refactoring` -  对应文章中目录: 第二次代码重构
     `the_third_refactoring` -  对应文章中目录: 第三次代码重构
     `the_fourth_refactoring` -  对应文章中目录: 第四次代码重构
      `master`                -  最后完成的代码

查阅和切换分支

    # 复制代码
    git clone https://github.com/zhoujiping/build-your-own-php-framework.git

    # 切换分支
    git checkout the_first_refactoring

先创建数据库

使用 Mysql 数据库,创建名为 todolist 的数据库,数据库中只有一个表tasks, 字段如下:

    +-------------+------------------+------+-----+---------+----------------+
    | Field       | Type             | Null | Key | Default | Extra          |
    +-------------+------------------+------+-----+---------+----------------+
    | id          | int(11) unsigned | NO   | PRI | NULL    | auto_increment |
    | description | text             | NO   |     | NULL    |                |
    | completed   | tinyint(1)       | NO   |     | NULL    |                |
    +-------------+------------------+------+-----+---------+----------------+

config.php 中的配置

    return [
        'database' => [
            'name'          => 'todolist', // 数据库名
            'username'      => 'root',  // Mysql 登录用户名
            'password'     => 'password', // Mysql 登录密码
            'connection'    => 'mysql:host=127.0.0.1',
            'options' => [
                PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
            ]
        ]
     ];

build-your-own-php-framework's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.