A RESTful persistence solution usable with backbone.js... in PHP?(一个 RESTful 持久性解决方案,可用于 Backbone.js... 在 PHP 中?)
问题描述
我先说我是一个蹩脚的程序员,我确信我想做的事情可以在 10 行 node 或 Rails 或其他东西中完成,但 PHP 是我可用的.
I'll preface this with saying that I'm a crappy programmer, I'm sure that what I want to do could be done in 10 lines of node or Rails or something else, but PHP is what I have available.
所以,我希望找到一个简单的 PHP 库,它将数据库调用封装在一个类似于 RESTful 模型的 API 中.
So, I'm hoping to find a simple PHP library which wraps the database calls in an API that looks similar to the RESTful model.
我在尝试找到这样的东西时收效甚微——搜索 PHP CRUD
或 PHP REST
会出现无数个页面,我不知道如何过滤它们.
I've had little success trying to find such a thing -- searching for PHP CRUD
or PHP REST
turns up several zillion pages, and I've no idea how to filter through them.
我真的想在这里保持简单,我不想要像 Zend 之类的大框架.我在 Backbone 中处理的模型非常简单.我只想将 GET
s 发送到 /notes/3
或 POST
s 到 /notes
,等等,并让 PHP 对数据库做正确的事情.
I'm really trying to keep things simple here, I don't want a big framework like Zend or something. The models I'm dealing with in Backbone are really simple. I just want to send GET
s to, say, /notes/3
or POST
s to /notes
, etc, and have PHP do the right thing to a database.
也许我的要求太多了,但在我看来,这正是 Rails 等其他框架所提供的.有什么建议?TIA...
Perhaps I'm asking too much, but it seems to me that this is what other frameworks like Rails provide. Any suggestions? TIA...
推荐答案
EDIT Nov 2018: 虽然我不会敲 CodeIgniter,但现在 Laravel(目前是5.5)是我使用的框架.
EDIT Nov 2018: Although I wouldn't knock CodeIgniter, nowadays Laravel (currently 5.5) is the framework I use.
这是一篇好文章总结总结我使用 Laravel 的原因.
Here is a good article that sums up the reasons I use Laravel.
要快速入门,我建议使用 Laracasts.这是一个订阅视频教程服务,深入介绍如何使用 Laravel(以及其他与 Web 开发相关的内容).
To get jump started, I recommend Laracasts. It's a subscription video tutorial service that goes in depth on how to use Laravel (and other web dev related things).
原始答案:
Codeigniter 对我来说,是最简单的类 Rails 框架.它很简单,您可以轻松地从头开始构建 CRUD 应用.
Codeigniter, to me, is the easiest of the Rails-like frameworks. It's bare bones, and you can build a CRUD app from scratch easily.
推出自己的应用的最大问题是安全性.Codeigniter 可以通过保护您免受许多常见的安全风险(例如直接使用 $_POST 数组,而不是正确过滤您的数据)来帮助您构建一个不易被黑客入侵的站点.更不用说它提供的许多帮助类,例如表单验证.
The biggest issue with rolling your own app is security. Codeigniter can help you build a less hackable site by shielding you from many of the common security risks, such as using $_POST arrays directly, and not properly filtering your data. Not to mention the many helper classes it offers such as form validation.
您可以在他们的网站上查看文档.只要您记住导航隐藏在每个页面的顶部,它就非常易于使用.:D
You can view the documentation on their website. It's very easy to use as long as you remember the navigation is hidden at the top of each page. :D
这篇关于一个 RESTful 持久性解决方案,可用于 Backbone.js... 在 PHP 中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:一个 RESTful 持久性解决方案,可用于 Backbone.js... 在 PHP 中?
基础教程推荐
- HTTP 与 FTP 上传 2021-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01