search
HomeBackend DevelopmentPHP Tutorial 框架是什么,为啥要用框架. 框架解决了什么

框架是什么,为什么要用框架. 框架解决了什么.
我是刚学的. 把一简单的select  结果放到网页上.

直接写点php 代码就行了.
用框架干什么. 整个框架一大堆代码,读也读不懂.鬼知道里面发生了什么事.
而且要用框架,还要花很多时间学习它.

我"把一简单的select  结果放到网页上" 这件事上,我感觉框架屁用没有.

网上只说框架方便程序员,做了基础工作. 都是一些废话.
谁能举行个实例说下,框架到底起到了什么作用.


------解决方案--------------------
框架有点像类库

比如处理数据使用ORM类 自动处理URL 动态静态切换 权限系统
如果不是你还得做很多工作

queryphp 框架基本是类库

http://code.google.com/p/queryphp/downloads/list
------解决方案--------------------
不要被“名词”吓到,也许同样的“名词”会变成你手中的“法宝”

什么是“框架”,框架是应用程序“模板”
就好比“八股”文章,不论好坏,按照规则填填就是

什么是“应用程序”,应用程序是完成某项特定任务的代码堆砌
也可以说是“套路”
当你完成了一、二个项目后,你是不会放弃承载着你大量心血的“代码集”的
你会在第三、第四...个项目中重复你的思路、代码,当然也包括改进或创新
于是,“框架”出现了......



------解决方案--------------------
框架,只是简化了程序员的工作。
将很多的类库集成到一起。
你会用框架就行,不需要理解框架是怎样做到这一点的。它是怎样做到的。 这些你可以不理。当然你想做一个出色的程序员,去理解是有必要的
------解决方案--------------------
对你现在的水平,框架是一个垃圾,或者以后也是

不信你直接输出 echo 'Hello you.'; 和在框架下输出字符 Hello you看有什么区别?

再分别循环十万次输出看那个效率?

对于以上两个问题你能说出结果,并测试过,就知道框架有什么用,什么时候用,能真的解决问题吗。
------解决方案--------------------

引用:
对你现在的水平,框架是一个垃圾,或者以后也是

这句牛。。。

仅个人感受。
我是用ci 框架的。
用后和用前的差别。
1 我不再为一些基础类库去烦了。
2 我知道配置在哪,模版在哪,如何写helper 如何去libraries 如何hook,如果是以前,自己单独写这些时,经常因摆放位置不当到处找文件。
3 框架提供了很多很好的服务。
4 如果你觉得框架垃圾,请先在工资上超越用框架的人。个人觉得,楼主这心态,工资不会超过5000.
<br>
    * User Guide Home<br>
    * Table of Contents Page<br>
<br>
Basic Info<br>
<br>
    * Server Requirements<br>
    * License Agreement<br>
    * Change Log<br>
    * Credits<br>
<br>
Installation<br>
<br>
    * Downloading CodeIgniter<br>
    * Installation Instructions<br>
    * Upgrading from a Previous Version<br>
    * Troubleshooting<br>
<br>
Introduction<br>
<br>
    * Getting Started<br>
    * CodeIgniter at a Glance<br>
    * CodeIgniter Cheatsheets<br>
    * Supported Features<br>
    * Application Flow Chart<br>
    * Model-View-Controller<br>
    * Architectural Goals<br>
<br>
	<br>
General Topics<br>
<br>
    * CodeIgniter URLs<br>
    * Controllers<br>
    * Reserved Names<br>
    * Views<br>
    * Models<br>
    * Helpers<br>
    * Plugins<br>
    * Using CodeIgniter Libraries<br>
    * Creating Your Own Libraries<br>
    * Creating Core Classes<br>
    * Hooks - Extending the Core<br>
    * Auto-loading Resources<br>
    * Common Functions<br>
    * Scaffolding <div class="clear">
                 
              
              
        
            </div>
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 Performance Tuning for High Traffic WebsitesPHP Performance Tuning for High Traffic WebsitesMay 14, 2025 am 12:13 AM

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

Dependency Injection in PHP: Code Examples for BeginnersDependency Injection in PHP: Code Examples for BeginnersMay 14, 2025 am 12:08 AM

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

PHP Performance: is it possible to optimize the application?PHP Performance: is it possible to optimize the application?May 14, 2025 am 12:04 AM

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

PHP Performance Optimization: The Ultimate GuidePHP Performance Optimization: The Ultimate GuideMay 14, 2025 am 12:02 AM

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.