simple PHP code sample to serve backbone.js

前端 未结 3 822
盖世英雄少女心
盖世英雄少女心 2021-02-02 16:33

Experience level: newbie.

The backbone.js Todos demo uses localStorage. This question is about how to use PHP to serve the page instead, assuming that a MySQL DB has bee

3条回答
  •  不知归路
    2021-02-02 16:58

    The example: https://github.com/ccoenraets/wine-cellar-php

    ... from this article:

    http://coenraets.org/blog/2011/12/restful-services-with-jquery-php-and-the-slim-framework/

    ... is good because it encapsulates a configured PHP RESTful server (Slim). From the perspective of working with backbone.js, this seems to essentially be the entirety of what you need on the server side - simply a RESTful service!

    For my basic web config (am not good with rewrite rules), I had to modify the file ../final/js/models/winemodel.js (where I add index.php) as follows:

    url:"../api/index.php/wines"
    

提交回复
热议问题