久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='msN5i'></tfoot>
    • <bdo id='msN5i'></bdo><ul id='msN5i'></ul>

      <small id='msN5i'></small><noframes id='msN5i'>

        <i id='msN5i'><tr id='msN5i'><dt id='msN5i'><q id='msN5i'><span id='msN5i'><b id='msN5i'><form id='msN5i'><ins id='msN5i'></ins><ul id='msN5i'></ul><sub id='msN5i'></sub></form><legend id='msN5i'></legend><bdo id='msN5i'><pre id='msN5i'><center id='msN5i'></center></pre></bdo></b><th id='msN5i'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='msN5i'><tfoot id='msN5i'></tfoot><dl id='msN5i'><fieldset id='msN5i'></fieldset></dl></div>
        <legend id='msN5i'><style id='msN5i'><dir id='msN5i'><q id='msN5i'></q></dir></style></legend>
      1. Backbone.js 如何與 PHP 一起使用

        Backbone.js How to use with PHP(Backbone.js 如何與 PHP 一起使用)
        <tfoot id='y5gAw'></tfoot>
          <tbody id='y5gAw'></tbody>

            1. <i id='y5gAw'><tr id='y5gAw'><dt id='y5gAw'><q id='y5gAw'><span id='y5gAw'><b id='y5gAw'><form id='y5gAw'><ins id='y5gAw'></ins><ul id='y5gAw'></ul><sub id='y5gAw'></sub></form><legend id='y5gAw'></legend><bdo id='y5gAw'><pre id='y5gAw'><center id='y5gAw'></center></pre></bdo></b><th id='y5gAw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='y5gAw'><tfoot id='y5gAw'></tfoot><dl id='y5gAw'><fieldset id='y5gAw'></fieldset></dl></div>

              1. <small id='y5gAw'></small><noframes id='y5gAw'>

                <legend id='y5gAw'><style id='y5gAw'><dir id='y5gAw'><q id='y5gAw'></q></dir></style></legend>
                  <bdo id='y5gAw'></bdo><ul id='y5gAw'></ul>
                  本文介紹了Backbone.js 如何與 PHP 一起使用的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我一直在研究backbone.js,但似乎無法弄清楚如何讓它與php通信以保存模型數(shù)據(jù).它發(fā)送一個請求,但我如何捕獲該請求,無論它是創(chuàng)建"、更新"、讀取"、刪除"等.

                  I have been looking into backbone.js and I can't seem to figure out how to get it communicate with php in order to save the models data. It sends a request but how do I capture that request whether it be "Create", "Update", "Read", "Delete" etc.

                  謝謝

                  推薦答案

                  您可以考慮的另一個選擇是使用預(yù)打包的 RESTful 框架,該框架內(nèi)置了執(zhí)行 Backbone 服務(wù)器查詢所需的所有功能.我個人最喜歡的是 Josh Lockhart 的 SlimPHP 框架.

                  Another option you may consider is to roll with a pre-packaged RESTful framework that has all the necessary functions built in to execute your Backbone server queries. My personal favorite is Josh Lockhart's SlimPHP Framework.

                  一些用于處理 Backbone 調(diào)用的簡單示例代碼(一旦您設(shè)置了 SlimPHP)如下所示.

                  Some simple sample code (once you have SlimPHP setup) used to take your Backbone calls look like this.

                  $app->get('/user', function() use ($app) {
                  
                      // See if session is set, get user info as array
                      if (isset($_SESSION['userID']) {
                           $user = // grab user with userID data from DB
                      }
                  
                      // Respond to the get request with a json object
                      $response = $app->response;
                      $response['Content-Type'] = 'application/json';
                      $response->body(json_encode($user));
                  }
                  

                  這是一個將 Backbone json 轉(zhuǎn)換為數(shù)組的 POST 示例.

                  Here is a POST example that turns Backbone json into arrays.

                  // Middleware that detects type of data and converts it to something usable
                  $app->add('Slim_Middleware_ContentTypes');    // JSON to associative array
                  
                  ...
                  
                  $app->post('/message', function() use ($app) {
                      $dataIn = $app->request()->getBody();
                  
                      ...
                  
                      // Save to DB $dataIn['message'], $dataIn['author'], etc.
                  }
                  

                  這是一個使用一些參數(shù)的 PUT 示例.

                  Here is a PUT example using some parameters.

                  $app->put('/user/:id', function($id) use ($app) {
                  
                      // Find appropriate user from DB that has $id as ID
                  
                      $dataIn = $app->request()->getBody();
                  
                      // Save to DB $dataIn['name'], $dataIn['age'], etc.
                  }
                  

                  這里是一個 DELETE.

                  And here is a DELETE.

                  $app->delete('/message/:id', function($id) use ($app) {
                  
                      // Find appropriate message from DB that has $id as ID
                  
                      // Delete message with id of $id
                  }
                  

                  雖然這不是要考慮的所有其他事項的詳盡示例,但它應(yīng)該能讓您了解現(xiàn)有可供您使用的開放解決方案的種類.我個人喜歡 Slim,因為它非常輕巧、簡單,但它具有 RESTful 服務(wù)器所需的所有功能.非常適合原型制作.將它與數(shù)據(jù)庫抽象層和一些其他工具結(jié)合使用,您可以更快地制作任何您想要的東西.

                  While this isn't an exhaustive example of all the other things to consider, it should give you an idea of the kinds of open solutions already out there for you to use. I personally like Slim because it is so lightweight, simple, yet it has all the features you'd want in a RESTful server. Great for prototyping. Combine it with a DB abstraction layer and some other tools and you can make just about anything you want quicker.

                  您可以在此處查看其他一些示例代碼:

                  You can see some other sample code along these lines here:

                  1. 如何發(fā)帖到服務(wù)器的骨干模型
                  2. 保存 Backbone 數(shù)據(jù)的方法

                  這里是一些其他基于 PHP 的 RESTful 解決方案的鏈接:框架列表

                  And here is a link to some other PHP based RESTful solutions: Framework List

                  這篇關(guān)于Backbone.js 如何與 PHP 一起使用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)

                    <small id='GFuD0'></small><noframes id='GFuD0'>

                    <i id='GFuD0'><tr id='GFuD0'><dt id='GFuD0'><q id='GFuD0'><span id='GFuD0'><b id='GFuD0'><form id='GFuD0'><ins id='GFuD0'></ins><ul id='GFuD0'></ul><sub id='GFuD0'></sub></form><legend id='GFuD0'></legend><bdo id='GFuD0'><pre id='GFuD0'><center id='GFuD0'></center></pre></bdo></b><th id='GFuD0'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GFuD0'><tfoot id='GFuD0'></tfoot><dl id='GFuD0'><fieldset id='GFuD0'></fieldset></dl></div>
                    • <bdo id='GFuD0'></bdo><ul id='GFuD0'></ul>

                        <tfoot id='GFuD0'></tfoot>
                        <legend id='GFuD0'><style id='GFuD0'><dir id='GFuD0'><q id='GFuD0'></q></dir></style></legend>
                          <tbody id='GFuD0'></tbody>

                            主站蜘蛛池模板: 先锋资源站 | 在线观看毛片网站 | 欧美精品片 | 欧美一区二区三区在线视频 | 国产午夜精品久久久 | 久久男人 | 中文字幕一区二区三区在线观看 | 色久影院| 在线欧美日韩 | 日韩亚洲视频 | 日本精品一区二区三区在线观看视频 | 久久91 | 成人高清视频在线观看 | 免费观看一级特黄欧美大片 | 国产精品视频一区二区三区 | 日韩精品无码一区二区三区 | 波多野结衣一区二区三区在线观看 | 一区二区三区电影网 | 国产日韩欧美精品一区二区 | 黄色国产视频 | 91精品国产综合久久久动漫日韩 | 黄色网址在线播放 | 老司机免费视频 | 久久99国产精品 | 国产在线一区二区三区 | 欧美大片一区二区 | 日韩精品在线观看视频 | 日韩波多野结衣 | 老头搡老女人毛片视频在线看 | 伊人av在线播放 | 久久久国产精品网站 | 久久久久久久夜 | 久久精品亚洲精品国产欧美 | 久久99精品久久久久久国产越南 | 欧美精品久久久久久 | 国产精品久久久久久久久久免费 | 97久久久久久久久 | 国产一区二区三区在线 | 午夜精品在线观看 | 亚洲欧洲精品一区 | 在线成人一区 |