PHP CodeIgniter 框架 - 关于使用它进行开发的想法?

发布于 2024-08-25 11:19:59 字数 479 浏览 6 评论 0原文

我一直在审查用于我接下来的几个主要 Web 应用程序的不同框架,经过几天的研究,我几乎决定使用 CodeIgniter

我倾向于 CI 的原因是,到目前为止它看起来最适合我。它不需要持续的命令行访问(我目前正在使用共享托管;这些项目还不需要专用服务器),不需要在运行它的服务器上安装任何特殊的东西(您只需将框架上传到无论您正在开发什么),他们似乎都有一些关于如何入门的优秀文档、视频和教程。

你们中有人有使用 CodeIgniter 的经验吗?如果是这样,您对它及其功能有何看法?您用它开发了什么?它最适合创建什么类型的应用程序?我当然不想陷入这样的境地:我试图改变一个框架来做一些它不适合的事情。

我的两个项目都是数据库驱动的应用程序,需要用户注册、操作特定于其帐户的数据(他们的帖子、列表、用户帐户详细信息等)的能力等等。

另外,如果您有任何其他 PHP 框架建议,我愿意接受。

预先感谢您的帮助!

-苏塔

I've been reviewing different frameworks to use for my next couple of major web applications, and after days of research am almost set on using CodeIgniter.

The reason I'm leaning towards CI is that so far it looks to be the best suited for me. It doesn't require constant command-line access (I am currently using shared hosting; the projects do not warrant a dedicate server yet), nothing special has to be installed on the server running it (you just upload the framework to the root of whatever your developing), and they appear to have some excellent documentation, videos, and tutorials on how to get started.

Do any of you have experience with CodeIgniter? If so, what is your opinion of it and its features? What had you developed with it, and what types of applications is it best suited to create? I certainly don't want to get into a situation where I'm trying to bend a framework to do something that it isn't well-suited for.

Both of my projects will be database-driven apps that will require user registration, the ability to manipulate data that is specific to their account (their posts, listings, user account details, etc), amongst other things.

Also, if you have any other PHP framework suggestions, I am open to them.

Thanks in advance for your help!

-Sootah

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

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

发布评论

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

评论(8

浪推晚风 2024-09-01 11:19:59

CodeIgniter 是我的第一个框架。它很棒,因为它拥有强大的社区和优秀的文档,但问题是它试图保留与 PHP 4 的向后兼容性,因此缺乏现代框架具有的许多“标准”功能,例如自动加载。此外,它是由商业公司支持的,并且更新频率不高。

以下是加载模型、助手等的方法:

$this->load->model('user');
$this->load->helper('array');

哎呀,自动加载就是为了这种情况而设计的。

输入 Kohana。 Kohana 严格来说是 php5,最初是作为 CodeIgniter(以前称为 Blue Flame)的一个分支创建的,但后来被重写了。前面的站点显示 Kohana 2.* 文档和下载,但我真的建议使用新的 3.* 分支。它更干净,但缺少官方文档。不过,社区 wiki 非常出色,您可以通过它轻松开始创建网站。

我也更喜欢 Kohana 社区。它的编织更加紧密。这很难解释,但他们看起来更“自豪”......该框架散发出一种黑客氛围,因为它它是如此轻量,你可以用它做任何你想做的事情。归根结底,它实际上只是一堆松散耦合的类。我真的推荐它。

Kohana 的源代码也有非常详细的文档记录并且非常清晰。当 Kohana 3 beta 发布时,我只是通过阅读源代码(wiki 还没有)来学习这个框架。我以前从未这样做过,但由于代码质量,我做到这一点没有任何困难。

此外,由于该框架是社区驱动的,因此它会收到更频繁的更新。

CodeIgniter was my first framework. It's great because it has a strong community and excellent documentation, but the problem is that it tries to retain backward compatibility with PHP 4 and therefore lacks a lot of "standard" features modern frameworks have such as autoloading. In addition, it's backed by a commercial company and it's not updated very often at all.

Here is how you load models, helpers, etc:

$this->load->model('user');
$this->load->helper('array');

Yuck, autoloading was meant for this kind of situation.

Enter Kohana. Kohana is strictly php5 and was initially created as a fork of CodeIgniter (it used to be called Blue Flame), but it has since been rewritten. The front facing site shows Kohana 2.* documentation and downloads, but I'd really recommend using the new 3.* branch. It's much cleaner, but the official docs are lacking. However, the community wiki is excellent and you can get started on a website easily with this.

I also like the Kohana community a lot better. It's more tight knit. It's hard to explain, but they seem more "proud"... the framework gives off a kind of hacker vibe because's it's so lightweight and you can do whatever you want with it. When it comes down to it, it's really just a bunch of loosely coupled classes. I really recommend it.

Kohana's source code is also incredibly well documented and is very clear. Back when the Kohana 3 beta was out, I learned the framework just by reading the source code (the wiki wasn't around yet). I've never done that before, but I had no trouble doing it just because of the code quality.

Also, since the framework is community driven, it receives much more frequent updates.

各空 2024-09-01 11:19:59

我想我应该插话一下,因为大约 12 个月前我也曾在同一个地方。我一头扎进了CI,再也没有回头。我喜欢 CI 的 MVC 方法 - 我以前从未真正做过任何 OOP,但 CI 确实强调了这种方法的好处。意想不到的好处是我已经能够快速适应其他OOP框架。此外,他们的文档和论坛也很棒,这在采用新事物时至关重要。我也喜欢 url 的处理方式 - 非常干净:domain.com/className/methodName,而且您还可以构建自定义路由模式。

我确实觉得我也应该为 CI 辩护...CI 确实提供了自动加载功能,但不会在盲目加载模型时做出任何假设。为您的站点、类或单个方法加载它们。

总而言之,我喜欢 CI,它促使我构建更强大、功能更强大的 Web 应用程序 - 我鼓励每个人都尝试一下。

I thought I'd chime in here having been in the same spot you were some 12 months ago. I jumped into CI and haven't looked back. I LOVE CI's MVC approach - I had never really done any OOP before, but CI really emphasises the benefits of this approach. The unexpected benefit is that I've been able to quickly adapt to other OOP frameworks. Also, their documentation and forums are amazing, which is mission critical when adopting something new. I also love the way the urls are handled - very clean: domain.com/className/methodName, AND you can also build in custom routing patterns.

I do feel like I should come to CIs defense too...CI does offer autoloading at your discression, but doesn't make any assumptions in blindly loading models. Load them for your site, a class, or an individual method.

All in all, I enjoy CI I it's urged me to build stronger more capable web apps - I encourage everyone to give it a try.

无人问我粥可暖 2024-09-01 11:19:59

我使用 CodeIgniter 制作了一个网站,玩家可以在其中上传他们为游戏制作的自定义模组。它允许他们登录、上传文件、下载、评价模组以及执行其他类似的操作。总的来说,我对 CI 非常满意,因为它相对容易设置和学习如何使用,并且可以编写非常干净的代码。可维护性也相当不错。我还喜欢它没有强迫我使用相对与数据库无关的 MySQL。

老实说,听起来它非常适合您的项目。它绝对是完美的解决方案吗?我不知道,但这肯定能完成工作。

I used CodeIgniter to make a website that was used as a place where players could upload custom mods that they had made a for a game. It allowed them to login, upload files, download, rate mods, and do other similar sorts of things. I was quite pleased with CI in general, as it was relatively easy to setup and learn how to use and also to make very clean code. Maintainability was also quite good. I also liked that it didn't force me to use MySQL being relatively database agnostic.

It quite honestly sounds like it could work very well for your project. Is it absolutely the perfect solution? I don't know, but it would definitely get the job done.

溺渁∝ 2024-09-01 11:19:59

我非常高兴使用 CI 开发两个相当小的 Web 应用程序。使用 Ruby on Rails 后,CI 的 MVC 方面很容易掌握,尽管 CI 是一个比 RoR 更“宽松”的框架。我喜欢 CI,因为它可以很好地组织代码,但最终让您能够灵活地按照自己认为合适的方式使用代码。

您可以考虑的一些替代方案是:

I have been very happy using CI to develop two rather small web applications. Having worked with Ruby on Rails, the MVC aspects of CI were easy to pick up, although CI is much "looser" a framework than RoR. I like CI since it does a good job of organizing your code, but ultimately gives you the flexibility to work with your code how you see fit.

Some alternatives you may consider are:

云之铃。 2024-09-01 11:19:59

CodeIgniter 非常有用并且非常容易学习。它很简单,但也可能是一个优势。我从它开始,然后转向我非常喜欢的 Kohana 2.x。现在有 Kohana 3.x,但我没有找到与以前版本一样的明确信息。

我认为 CodeIgniter 会满足您的需要。也许您应该开始使用 2.x(现在处于 Beta 版)分支。如果你想要更详细的东西,我建议你考虑一下我现在也在学习的 Yii (www.yiiframework.com)。

CodeIgniter is very useful and very easy to learn. Its a kind of simple but it could be an advantage too. I began with it and then went to Kohana 2.x that I liked very much. Now there is Kohana 3.x but I didn't find clear information as with its previous version.

I think CodeIgniter will do what you need. Probably you should begin to play with the 2.x (now in Beta) branch. If you want something more elaborate I suggest you consider Yii (www.yiiframework.com) that I am also learning right now.

说好的呢 2024-09-01 11:19:59

@Sootah

CI 将在 CI 2.1.0 中放弃 PHP 4 支持。因此,较旧的代码仍可在 2.1.0 上运行,但新功能将不再支持 PHP 4。CI

对我来说是最好的 PHP 框架。如果您打算使用 PHP 框架,那么请使用 CI。

@Sootah

CI is going to drop PHP 4 support with CI 2.1.0. So older code will still work with 2.1.0 but new features will no longer support PHP 4.

CI is for me the best PHP framework. If you are going to use a PHP framework then use CI.

念三年u 2024-09-01 11:19:59

仅供参考 - Codeigniter 2.0 已经发布一段时间了,并且已经采取了许多步骤来实现全部 PHP5。我用它建立了几个网站。

FYI - Codeigniter 2.0 has been out for a while and has taken many steps towards being all PHP5. I've built several sites with it.

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