search
HomeBackend DevelopmentPHP TutorialCodeIgniter 框架怎么样?具体有什么优缺点?

CodeIgniter 框架怎么样?具体有什么优缺点?听说他的 session 不是很好用。

回复内容:

CodeIgniter 框架怎么样?具体有什么优缺点?听说他的 session 不是很好用。

优点

简介、优雅。

在那些 PHP 框架中,可以说 CI 的思维模式最接近 PHP 初级程序员了,所以,很多 PHP 程序员遇到 CI 后就喜欢上了。相比之下 Cake 的思维模式太接近 ruby,那些从 ROR 转到 PHP 阵营来的程序员应该比较喜欢 Cake,而我则更喜欢 ZendFramwork,原因很简单,我是从 Java 阵营转到 PHP 来的。

同样是中小企业框架,国内的开发者,尤其是使用百度进行搜索的开发人员,应该会更偏爱 ThinkPHP 。

缺点

CI 的核心小,很轻量级,但是因为一味追求小,性能,也使用了不少的全局变量,比如 global $IN, $BM, $CFG, $URI, $LANG, $OUT;。

还有一个缺点,也许是由于我使用 Java 的原因,对 CI 的单一实例很不习惯。

现在就在用。。。小的php mvc (专业点叫 轻量级。。。) 不是很喜欢。。。特别是 $this->load。。。 入门可以的吧, 用来理解mvc框架还是行的, 学习完直接再看zf 或 yii吧

Hack过CI的底层。

优点

CodeIgniter实现的简洁明白是其中一方面,另外很重要的一点是CI尽最大努力兼顾了PHP4,也就是说,CI的平台兼容性非常的好。

可用性方面,CI提供了不错的扩展方式并且自带了很多library和helper,简单使用起来还是很容易上手和方便使用的。

缺点

对扩展组件的继承比较保守,很多实用组件需要自己去添加。这其实也应该是为了保持精简所致。

还有就是@codeigniter所提到的,过分追求短小,有一些设计上的瑕疵。


一般来说拿来做逻辑不是过于复杂的系统还是可以胜任的,而如果要动起真格的来,最好还是用Zend或者Symfony吧。

接触过一点CI 感觉有点过于追求精简了。建议看看symfony2,相当赞

CI性能一般,但很容易上手,开发文档比较全,周边儿的一些库也比较多,session 模块不好用,可以自己写个lib实现,不是很复杂。

现在一个项目中客户要求用。 框架简洁,上手容易,结构简单,AR实现过于简单,很多需要自己写库处理,没有autoload; 现在做的项目比较大,觉得CI不适合做大型项目

优点是小.

缺点是太小.

php最舒服的框架是cakephp.

做为初级PHP想学习框架的话,CI框架无疑是最合适的(目前为止) 有一定能力的PHPer,还是应该看看Zend框架,Zend确实很大,臃肿。 但是代码很规范。

先把CI用透了,自己写一些 helper library 再学Symfony2不迟

优点: 简单易学 档案清楚

缺点: 很多功需要一定的hack,或者使用一些不应该使用的技巧绕过去。 框架开发缓慢,原始公司已经放弃继续开发了,保持开发保持在停止状态

小巧轻便,对于一般的小型项目开发算方便,PHP中国社区就是用ci开发的。

只說缺點: Ellislab 想為Codeigniter找新東家, 要放棄Codeigniter了

http://ellislab.com/blog/entry/ellislab-seeking-new-owner-for-codeigniter

CI里面有用过session吗...是通过cookie实现...

优点:无需配置,快速上手,文档丰富。
缺点:用过这个框架之后,自己对面向对象编程的概念都模糊了。。。

优点

简单、易上手,学习曲线低。特别是对初学了php的用户,使用ci框架能迅速将代码机构化,易于管理。

缺点

作为框架来说,多东西有些过时了。好多流行新功能都没有,如ORM、routes、template、没有命令行工具、没有流行的Migrateions、默认不适用composer等等。

总体来说,作为新手,ci是一个不错的选择,话说我第一个项目就是使用ci开发的。

看过好几次这个问题里的答案,现在也来说说自己的想法。
所谓MVC框架,其实在我眼中不过是Router+Controller的前端控制器模式,外加封装了数据库类和视图类而已。只要简单的做到这一步,就可以被称为一个MVC框架。
像有些被称为Restful框架的框架,也无非改善了Router+Controller的前端控制器模式使其更符合Rest的思路,然后可能省略了数据库类和视图类的封装。
对于这些,我都统一称为后端框架。
说句老实话,CI的框架实现很粗糙,数据库类和视图类的封装很弱,但是对PHP新人很友好,这是其最大的优点。
首先,虽然实现粗糙,但是毕竟实现后端框架的从Router到Controller,各种安全方面的东西也不怎么需要使用者考虑,也能充当一个小项目的基础。
其次,代码非常符合初级程序员的思维,也非常适合初级程序员去理解。对于帮助PHP新人实现从模板语言式的开发到理解框架式的开发很有帮助。
最后,在这个composer第三方模块满天飞的时代,CI已经不太合时宜了。PHP程序员千万不能止步在这个框架上,需要进一步学习laravel,symfony等更现代化的框架。

久不更新了

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP's Purpose: Building Dynamic WebsitesPHP's Purpose: Building Dynamic WebsitesApr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP: Handling Databases and Server-Side LogicPHP: Handling Databases and Server-Side LogicApr 15, 2025 am 12:15 AM

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

How do you prevent SQL Injection in PHP? (Prepared statements, PDO)How do you prevent SQL Injection in PHP? (Prepared statements, PDO)Apr 15, 2025 am 12:15 AM

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python: Code Examples and ComparisonPHP and Python: Code Examples and ComparisonApr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP in Action: Real-World Examples and ApplicationsPHP in Action: Real-World Examples and ApplicationsApr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: Creating Interactive Web Content with EasePHP: Creating Interactive Web Content with EaseApr 14, 2025 am 12:15 AM

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python: Comparing Two Popular Programming LanguagesPHP and Python: Comparing Two Popular Programming LanguagesApr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

The Enduring Relevance of PHP: Is It Still Alive?The Enduring Relevance of PHP: Is It Still Alive?Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.