使用codeigniter框架还是标准php?

发布于 2024-11-08 13:10:16 字数 1432 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

独留℉清风醉 2024-11-15 13:10:16
  • CodeIgniter 有一个学习曲线,但该曲线可能比您的自定义框架更快。这是因为 CodeIgniter 有详细的文档记录。
  • CodeIgniter 是一个相当全面的库。一旦学习了该框架,您不仅可以在当前项目中而且可以在各种其他项目中使用它的任何库。
  • 这项工作已经为你完成了。您甚至可能不知道代码中存在 XSS 或 CSRF 漏洞,因为您没有进行彻底的安全审核。但社区框架正在不断接受审核。
  • 您可以根据自己的需要扩展 CodeIgniter,并且仍然具有自定义功能。
  • 使用 CodeIgniter 足够长的时间后,您将不可避免地获得一些出色的编程实践并提高您的整体知识,因为该框架采用了许多最佳实践。
  • 如果您遇到问题情况,很可能其他人已经解决了。 CodeIgniter 还有一个很好的社区,通过它您可以节省数小时的调试时间。

也就是说,CodeIgniter 并不是唯一的框架,但我真的很喜欢这样一个事实:随着新版本的发布,它们已经迁移到 PHP5。一般来说,开源框架是正确的选择。

  • CodeIgniter has a learning curve but that curve is likely to be quicker than your custom framework. That's because CodeIgniter is well documented.
  • CodeIgniter is a fairly comprehensive library. Once you learn the framework, you can employ any of its libraries not only in the current project but in various other projects.
  • The work is already done for you. You may not even know that a XSS or CSRF exploit exists in your code because you haven't done a thorough security audit. But a community framework is under constant audit.
  • You can extend CodeIgniter to your own needs and still have custom functionality.
  • After using CodeIgniter for a sufficient period of time, you'll inevitably pick up some great programming practices and improve your overall knowledge since the framework employs many best practies.
  • It is likely that if you encounter a problem situation, someone else has already solved it. CodeIgniter also has a good community through which you could save yourself hours of debugging.

That said, CodeIgniter is not the only framework but I really do like that fact that with the newer release they have moved to PHP5. In general, open source frameworks are the way to go.

无悔心 2024-11-15 13:10:16

我强烈不同意。

项目的详细信息会非常有帮助,但总的来说框架非常有帮助,并且可以显着加快工作(不一定是应用程序)

考虑一下这样一个事实,“自定义 PHP 框架”(无论他们怎么想)是......自定义的。这意味着它没有经过测试,例如。 Zend Framework,它尚未在数千个项目中被证明是高效和成功的,而且它可能非常简单(因为大型框架已经由大型开发团队以及使用它们的公司的开发人员开发了多年)。

当然,当您确实需要(应用程序的)速度时,编写 PHP 代码可能是一个很好的选择,有时间来构建它,并且有钱支付将要广泛开发它的开发人员(因为他们将实现许多功能)几乎所有 PHP 框架)。但您必须确定,您确实需要采用非标准方法(“非标准”是指不使用某些可靠的框架)。

这取决于你。如果您可以提供有关必须创建的应用程序的一些详细信息,答案可能会更相关。

I would strongly disagree.

The details of the project would be very helpful, but in general frameworks are very helpful and speed up the work (not necessarily the application) significantly.

Consider the fact, that 'Custom PHP Framework' (whatever they think of) is... custom. That means it is not tested as eg. Zend Framework, it has not proven to be efficient and successful in thousands of projects, and it is probably something very simple (as large frameworks have been developed for years by big teams of developers plus the developers of companies that use them).

Of course coding PHP can be quite good option, when you really need speed (of the application), have time to build it and money to pay the developers that will be developing it quite extensively (because they will be implementing many features that come with almost every PHP framework). But you have to be sure, that you really need to take that non-standard approach (as 'non-standard' I mean not using some reliable framework).

It is up to you. If you can give some details about the application that has to be created, the answers may be more relevant.

你的呼吸 2024-11-15 13:10:16

非商业项目:标准 PHP。
商业项目:CI。

尝试构建自己的框架非常有教育意义,并且会对您有很大帮助;它还可以让您创建一个适合您需求的框架,而不是通用框架。但是,只有当您设法创建非商业项目时才能做到这一点,因为商业项目需要稳定性,而您可能无法从自制框架中获得稳定性。通过创建自己的框架,您可能会白白浪费大量时间(在处理业务内容时这是昂贵的)和金钱。

这基本上取决于您的项目类型。

Non-Business projects: Standard PHP.
Business projects: CI.

Trying to build you own Framework is very educative and will help you a lot; it will also let you create a framework that fit your needs instead of a general one. But that could be done only if you are managing to create a non Business projects because Business ones requires stability that you may not get from a home-made framework. By creating your own framework you might loose a lot of time (which is expensive when working with business stuff) and money for nothing.

It basically depends on your project type.

我有一些编写自己的 CMS 的经验,我必须承认,这是非常有教育意义的,但从财务角度来看,这是完全不经济的决定。

在我看来,那些开发人员应该尝试编写一些规范。他们需要实施的内容非常详细的规范。然后,他们应该计算编写此类功能所需的时间,以便可以将这项工作与 CI 中已包含的元素进行比较,并决定哪个选项在编码时间、学习时间以及测试时间方面更可行。

I have some experience with writing my own CMS, and I must admit, that this was very educating, but from financial point of view, totally uneconomic decision.

In my opinion, those developers should try to write some specification. Very detailed specification of what they need to implement. Then they should calculate time needed to code such functionality so they can compare this work to elements already included in CI and decide which option is more viable in terms of time to code, time to learn, and of course time to test.

烟─花易冷 2024-11-15 13:10:16

如果他们不介意教授他们的自定义框架,那么它可能是最合适的(特别是如果编写它的人仍然存在的话)。

然而,自定义框架可能会变成难以忍受的噩梦。 CI 的优势在于社区规模小和文档详尽。一旦您使用它推出了一些项目,我确信推出时间将与自定义框架一样快。

If they don't mind teaching their custom framework, then it's probably the best fit (especially if the guy who wrote it is still around).

However, custom frameworks can turn into unsupportable nightmares. CI has the advantage of a small community and thorough documentation. Once you roll out a few projects with it, I'm sure the roll-out time will be as fast as the custom framework.

战皆罪 2024-11-15 13:10:16

我们放弃了自己的自定义框架,转而使用 CI。从财务角度来说,这是一个艰难的决定,因为我们为此花费了 1000 个小时,并且有很多项目正在运行。

CI 使我们能够更快地开发并标准化了我们的项目。该架构还允许我们轻松扩展,而不必担心“损坏”核心框架。

IMO 中 CI 是前进的方向

We ditched our own custom framework in favour of CI. Financially it was a tough decision as weve spent 1000's of hours on it and have a lot of projects running on it.

CI has allowed us to develop faster and has standardised our projects. The architecture also allows us to extend easily without concerns about 'damaging' the core framework.

CI is the way forward IMO

上课铃就是安魂曲 2024-11-15 13:10:16

他们的回答是准正确的......

 缺点:团队推出项目的速度也慢一些。

这通常是不真实的,事实上,在许多情况下可能恰恰相反。就我个人而言,我能够使用框架更快地开发项目。我没有在团队环境中使用过 MVC,但我想通过将工作划分为模型、视图和控制器,工作流分离将提高开发速度。

你在建造什么?这是关键问题。

如果您正在构建动态 Web 应用程序,框架将为您节省大量的工作时间,因为您不必一遍又一遍地重新发明轮子。如果您的项目的重点是基础,那么框架确实会增加太多开销。我想说,作为一般规则,如果您的项目需要超过 5 个 .php 文件,那么开始使用框架,因为这就是它的目的 - 分离逻辑。

对于您怀疑代码会开始变得混乱的大型项目,请使用 CodeIgniter 或其他框架。 MVC 模式可以防止这种混乱。

听起来好像您以前从未使用过框架。决定一个框架是否适合该任务的第一步是熟悉一个框架。这样您就可以更好地拨打电话。我不建议您立即自己编写;使用 CI、Cake 或 Zend 后,您将获得很多见解。

Their response was quasi-correct...

   Disadvantage: also a bit slower for the team to roll out the project.

This is generally untrue, and infact, it's probably quite the contrary in many cases. Personally, I am able to crank out projects much faster using a framework. I haven't used MVC in a team environment but I would imagine that by dividing work into Models, Views and Controllers workflow seperations would promote development speed.

What are you building? This is the crucial question.

If you're building a dynamic web application, frameworks will save you hours and hours of work because you won't have to reinvent the wheel over and over again. If the point of your project is basic, then indeed... frameworks add too much overhead. I'd say, as a general rule, if you're project will require greater than 5 .php files, then start using a framework, because that's what it's purpose is - to separate the logic.

Use CodeIgniter or another framework for larger projects where you suspect your code will start to get disorganised. The MVC pattern prevents this disorganisation.

It sounds as if you've never used a framework before. The first step in making decisions on whether or not a framework will suit the task is to get familiar with one. You'll then be in a much better position to make this call. I do not recommend you write your own right away; you will gain a lot of insight after playing around with CI, Cake, or Zend.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文