23

从开发的角度来看,我一直在阅读 codeigniter 有多棒。而且我确信使用该框架将使开发过程更快。但我问自己的问题是,单独制作的框架是否会有所不同,以满足您的需求?

CI,尽管宣传的足迹很小,是否会因为它基本上是一个框架上的一个框架(后来将 PHP 称为 C 的框架)而使系统“陷入困境”?有没有很好的方法来分散负载?是否有任何使用 CI 制作的大型应用程序?

谢谢卡斯帕。

4

2 回答 2

22

I'm running a codeigniter site with about 11K files.

I've heavily modified the codeigniter's basic structure for my needs. For instance, I have 3 applications with 3 front controllers using the same system files. I'm using smarty as my templating engine. I have rich PHP web apps powered by jquery and prototype/Scriptaculous. I use form validation, authentication, active record, emailing, etc. etc.

My experience so far has been very positive.

Once you get a (real) templating engine like smarty plugged into Codeigniter you have all the power that you'll need for medium to large sites.

You have to think about organizing your site into large 'metagroups' as the 'controller' structure in Codeigniter expects such behavior. ('blogs', 'merchandise', 'forums', etc..)

CI is very easy to add plugins for.

The framework simplifies a lot of crap you would otherwise need to hand code. It's fast, simple and configurable.

My one big complaint with CI so far is that it's not very multi-application aware. The default layout assumes you're running 1 application. In my case, I have a global application with the global file that can be pulled into all running applications. However, this could be solved more elegantly. Additionally, you have to add a little extra fluff to switch between front controllers.

My favorite aspect of CI is easy of active record on a MySQL DB. It's dead simple to set up a DB connection and get active record queries running.

I would say that it's pretty easy to get started with. Just make sure you shop around and figure out how to plug smarty into your app. You CAN use the default 'view's of Codeigniter, but the minute you need if/else logic in your templates you're screwed.

I set up a 'templates' and a 'content' area in each app that I can fill with smarty templates and static content respectively. The rest I can pull from a DB connection.

于 2009-08-03T20:47:49.233 回答
20

这确实是一个只有你才能回答的问题。当您谈到“大型系统”时,您可能指的是主要使用的东西(通过浏览量等),或者包含大量业务规则但仅由少数人使用的东西。应用程序是否需要快速,或者您可以在多个服务器之间进行负载平衡吗?

IMO,您的“PHP 是 C 上的框架”评论完全不合时宜。不,PHP 不如 C 快。但它在处理 Web 请求方面要好得多。PHP 被用于世界上一些最大的网站——Facebook 最初是完全用 PHP 编写的。雅虎使用 PHP 相当多。所以 PHP 对几乎任何人来说都足够快,尤其是考虑到数据库几乎总是你的瓶颈。如果您的 PHP 应用程序变慢,您可以使用内存缓存/负载平衡器/在您的网络上放置更多应用程序服务器。很容易扩展 PHP 端的东西。

我可以告诉你的是与其他框架的简要比较。我在有限的部署中使用了 CI,主要是帮助其他人,但我所看到的,我很喜欢。与 CakePHP 相比,它为您提供了运行时速度优势,但它会增加您的开发时间(因为 Cake 的最大优势在于其快速开发和部署的能力)。在速度方面,它感觉与 Zend 或 Symfony 相当,仍然比自己编写原始 PHP 慢 5-7 倍。

总结各种框架(注意:我的意见如下):

  • CakePHP 非常适合快速开发。它的性能是主要框架中最差的,尽管 1.3 版本(即将推出!)应该让您免费(API 没有变化,他们只是删除了 PHP4 支持)25% 的速度提升。它专注于 ActiveRecord,并且可以非常快地启动和运行功能齐全的网站(说真的,非常快速的开发/原型制作)。
  • Zend 是使用最广泛的。它在添加模块方面具有最大的灵活性。它超级快,虽然不是特别轻巧。对于企业项目,我会选择这个或 symfony。感觉就像对我使用不同的库一样。而且他们的命名约定有点繁琐......
  • Symfony - 见 Zend 评论。尽管 symfony 应该更具企业精神。
  • CodeIgnitor is the new hot kid on the block. Its focused on staying out of your way while still being a "framework", i.e. a tool that will help you do your job faster. It's fast to run, but a little slower to develop.
于 2009-07-22T17:25:19.787 回答