为什么在PHP中使用ORM? [英] Why use an ORM in PHP?

查看:123
本文介绍了为什么在PHP中使用ORM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始学习ORM,一个问题浮现在脑海:

I recently start studying ORM, a question jumped to my mind:

PHP应用程序主要使用MySql和Sqlite,几乎所有的PHP服务器都已安装了该服务器,因此值得在PHP中使用ORM成为数据库独立的吗?

PHP applications use mostly MySql and Sqlite, almost all PHP servers have that installed, so is it worth to use ORM in PHP to be database-indipendent?

那性能呢?

推荐答案

数据库独立性不是使用ORM的主要原因.您想要拥有的是数据库的一般抽象.这可能意味着:使用简单,开发速度更快,数据库独立性……在任何情况下,通常都值得使用ORM.如果您的应用程序消耗了所有的cpu功能,那么您可以使用一些普通的sql来优化某些查询.我想这是一种罕见的情况.

database independence is not the main reason for using an ORM. what you want to have is a general abstraction of the database. this might imply: simplicity of use, faster development, database independence, ... in any case, usually it's worth using an ORM. if your application sucks up all your cpu power, then you might use some plain sql to optimize certain queries. I guess this is a rare case, though.

您可能想阅读以下内容: 使用ORM有什么好处?

you might want to read this: What are the advantages of using an ORM?

这篇关于为什么在PHP中使用ORM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆