点餐外卖系统开发PHP附源码

  点餐外卖系统开发是一个过程,在这个过程中,人们只需坐在家里或任何地方,就可以通过互联网从当地的一些餐馆和酒店订购各种食品和饮料。并将订单交付到指定的位置。

  PHP中的点餐外卖系统是一个使用 PHP、JavaScript 和 CSS 开发的简单源码项目。该项目将不同的餐厅与顾客联系起来。该项目包含一个管理员(经理)和用户端。编辑网站内容、更新食品、添加餐厅和检查订单状态等所有管理都可以从管理员端进行管理。站点上可以有许多管理员。

  演示:c.ymzan.top

  技术概述:

  前端:HTML、CSS、JavaScript

  HTML:HTML 用于创建和保存 Web 文档。例如记事本/记事本++

  CSS:(层叠样式表)创建有吸引力的布局

  Bootstrap:响应式设计的移动友好网站

  JavaScript:它是一种编程语言,通常与网络浏览器一起使用。

  后端:PHP、MySQL

  PHP:超文本预处理器 (PHP) 是一种技术,允许软件开发人员根据客户请求以 HTML、XML 或其他文档类型创建动态生成的网页。PHP 是开源软件。

  MySQL:MySql 是一种数据库,广泛用于访问、更新和管理数据库中的数据。

  软件需求(任意一项)

  WAMP 服务器

  XAMPP 服务器

  MAMP 服务器

ring.go

package

ring

import (

      "errors"

      "runtime"

      "sync/atomic"

      "time"

)

var (

      // ErrDisposed is returned when anoperation is performed on a disposed

      // queue.

      ErrDisposed = errors.New(`queue:disposed`)

      // ErrTimeout is returned when anapplicable queue operation times out.

      ErrTimeout = errors.New(`queue: poll timedout`)

      // ErrEmptyQueue is returned when annon-applicable queue operation was called

      // due to the queue's empty item state

      ErrEmptyQueue = errors.New(`queue: emptyqueue`)

)

// roundUp

takes a uint64 greater than 0 and rounds it up to the next

// power

of 2.

func

roundUp(v uint64) uint64 {

      v--

      v |= v >> 1

      v |= v >> 2

      v |= v >> 4

      v |= v >> 8

      v |= v >> 16

      v |= v >> 32

      v++

      return v

}


type node

struct {

      position uint64

      data    interface{}

}


type nodes

[]node


//

RingBuffer is a MPMC buffer that achieves threadsafety with CAS operations

// only. A put on full or get on empty call will blockuntil an item

// is putor retrieved.  Calling Dispose on theRingBuffer will unblock

// anyblocked threads with an error.  Thisbuffer is similar to the buffer

//

described here: http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue

// with

some minor additions.

type

RingBuffer struct {

      _padding0      [8]uint64

      queue          uint64

      _padding1      [8]uint64

      dequeue        uint64

      _padding2      [8]uint64

      mask, disposed uint64

      _padding3      [8]uint64

      nodes          nodes

}


func (rb

*RingBuffer) init(size uint64) {

      size = roundUp(size)

      rb.nodes = make(nodes, size)

      for i := uint64(0); i < size; i++ {

             rb.nodes[i] = node{position: i}

      }

      rb.mask = size - 1 // so we don't have todo this with every put/get operation

}


// Putadds the provided item to the queue.  Ifthe queue is full, this

// call

will block until an item is added to the queue or Dispose is called

// on thequeue.  An error will be returned if thequeue is disposed.

func (rb

*RingBuffer) Put(item interface{}) error {

      _, err := rb.put(item, false)

      return err

}


// Offeradds the provided item to the queue if there is space.  If the queue

// isfull, this call will return false.  Anerror will be returned if the

// queue

is disposed.

func (rb

*RingBuffer) Offer(item interface{}) (bool, error) {

      return rb.put(item, true)

}


func (rb

*RingBuffer) put(item interface{}, offer bool) (bool, error) {

      var n *node

      pos := atomic.LoadUint64(&rb.queue)

L:

      for {

             if atomic.LoadUint64(&rb.disposed)== 1 {

                    return false, ErrDisposed

             }


             n = &rb.nodes[pos&rb.mask]

             seq :=atomic.LoadUint64(&n.position)

             switch dif := seq - pos; {

             case dif == 0:

                    ifatomic.CompareAndSwapUint64(&rb.queue, pos, pos+1) {

                           break L

                    }

             case dif < 0:

                    panic(`Ring buffer in acompromised state during a put operation.`)

             default:

                    pos =atomic.LoadUint64(&rb.queue)

             }


             if offer {

                    return false, nil

             }


             runtime.Gosched() // free up thecpu before the next iteration

      }


      n.data = item

      atomic.StoreUint64(&n.position, pos+1)

      return true, nil

}


// Getwill return the next item in the queue. This call will block

// if thequeue is empty.  This call will unblockwhen an item is added

// to thequeue or Dispose is called on the queue. An error will be returned

// if the

queue is disposed.

func (rb

*RingBuffer) Get() (interface{}, error) {

      return rb.Poll(0)

}


// Pollwill return the next item in the queue. This call will block

// if thequeue is empty.  This call will unblock whenan item is added

// to the

queue, Dispose is called on the queue, or the timeout is reached. An

// error

will be returned if the queue is disposed or a timeout occurs. A

//

non-positive timeout will block indefinitely.

func (rb

*RingBuffer) Poll(timeout time.Duration) (interface{}, error) {

      var (

             n     *node

             pos   = atomic.LoadUint64(&rb.dequeue)

             start time.Time

      )

      if timeout > 0 {

             start = time.Now()

      }

L:

      for {

             ifatomic.LoadUint64(&rb.disposed) == 1 {

                    return nil, ErrDisposed

             }


             n = &rb.nodes[pos&rb.mask]

             seq :=atomic.LoadUint64(&n.position)

             switch dif := seq - (pos + 1); {

             case dif == 0:

                    ifatomic.CompareAndSwapUint64(&rb.dequeue, pos, pos+1) {

                           break L

                    }

             case dif < 0:

                    panic(`Ring buffer incompromised state during a get operation.`)

             default:

                    pos =atomic.LoadUint64(&rb.dequeue)

             }


             if timeout > 0 &&time.Since(start) >= timeout {

                    return nil, ErrTimeout

             }


             if timeout < 0 {

                    return nil, ErrTimeout

             }


             runtime.Gosched() // free up thecpu before the next iteration

      }

      data := n.data

      n.data = nil

      atomic.StoreUint64(&n.position,pos+rb.mask+1)

      return data, nil

}


// Len

returns the number of items in the queue.

func (rb

*RingBuffer) Len() uint64 {

      return atomic.LoadUint64(&rb.queue) -atomic.LoadUint64(&rb.dequeue)

}


// Cap

returns the capacity of this ring buffer.

func (rb

*RingBuffer) Cap() uint64 {

      return uint64(len(rb.nodes))

}


// Dispose

will dispose of this queue and free any blocked threads

// in thePut and/or Get methods.  Calling thosemethods on a disposed

// queue

will return an error.

func (rb

*RingBuffer) Dispose() {

      atomic.CompareAndSwapUint64(&rb.disposed,0, 1)

}


//

IsDisposed will return a bool indicating if this queue has been

//

disposed.

func (rb

*RingBuffer) IsDisposed() bool {

      return atomic.LoadUint64(&rb.disposed)== 1

}


//

NewRingBuffer will allocate, initialize, and return a ring buffer

// with

the specified size.

func

NewRingBuffer(size uint64) *RingBuffer {

      rb := &RingBuffer{}

      rb.init(size)

      return rb

}

  安装步骤

  1. 在您的本地服务器上下载 zip 文件和解压缩文件。

  2. 将此文件放入 "c:/wamp/www/" 中。

  3. 数据库配置

  打开 phpmyadmin

  创建名为 food的数据库。

  从下载的文件夹(数据库内)导入数据库food.sql

  4. 打开您的浏览器放入“ http://localhost/Online Food ordering system/”

  管理员登录详情

  登录 ID:root

  密码:toor

  该系统的特点如下:

  - 在线订购产品

  - 在线上传产品设计

  - 添加、编辑、删除产品

  - 通过电子邮件发送订单确认

  - 管理在线订单

  - 用于支付方式的 Ajax 分层组合框。

  - 在覆盖区域之外添加运费

  - 安全预订

  - 客户对网站发表评论的论坛

  - 生成各种报告

  - 等等

  对于用户部分,用户可以浏览主页、关于和联系页面。为了订购食物,用户必须创建一个帐户并登录或登录。食物也需要付费。该项目为客户在线购买/购买食物提供了一种便捷的方式,而无需去餐厅。

  这个点餐外卖系统采用 PHP、JavaScript 和 CSS 编写。谈到这个系统的功能,它包含管理员(经理)部分和用户(客户)部分。所有的编辑、更新、管理订单详细信息、食品和餐厅都来自管理部分,而客户只能通过该网站并在需要时下订单。该系统的设计和开发很简单,因此用户在使用它时不会遇到任何困难。

你可能感兴趣的:(点餐外卖系统开发PHP附源码)