我们的目的 ========== 现在有很多å„ç§å„æ ·çš„PHP框架,但他们没有一个åƒPhalconä¸€æ ·ï¼ˆçœŸçš„ï¼Œåœ¨è¿™ç‚¹ä¸Šè¯·ç›¸ä¿¡æˆ‘ï¼‰ å‡ ä¹Žæ‰€æœ‰çš„ç¨‹åºå‘˜éƒ½å–œæ¬¢ä½¿ç”¨æ¡†æž¶ï¼Œè¿™ä¸»è¦æ˜¯å› 为框架æä¾›äº†å¾ˆå¤šçš„功能,已ç»ç»è¿‡äº†å¤§é‡çš„æµ‹è¯•ï¼Œå› æ¤ä¿æŒä»£ç DRY(ä¸è¦é‡å¤é€ è½®å)。然而,框架本身需è¦åŒ…å«å¤§é‡çš„æ–‡ä»¶æ¥è§£é‡Šå’Œæ‰§è¡Œå®žé™…应用ä¸çš„æ¯ä¸ªè¯·æ±‚ï¼Œå› æ¤ä¼šé™ä½Žåº”用程åºçš„æ€§èƒ½ï¼Œå½±å“用户体验。 The Question ------------ 为什么我们ä¸èƒ½æœ‰è¿™æ ·ä¸€ä¸ªæ¡†æž¶ï¼Œä¿æŒå®ƒçš„ä¼˜åŠ¿çš„åŒæ—¶ï¼Œæ²¡æœ‰æˆ–者很少有缺点呢? 这就是为什么Phalconè¯žç”Ÿäº†ï¼ åœ¨è¿‡åŽ»çš„å‡ ä¸ªæœˆä¸ï¼Œæˆ‘们已ç»å¹¿æ³›åœ°ç ”究了PHP的行为,调查区域为显ç€ä¼˜åŒ–(大或å°ï¼‰ã€‚ 通过Zend引擎的ç†è§£ï¼Œæˆ‘们设法消除ä¸å¿…è¦çš„验è¯ï¼ŒåŽ‹ç¼©çš„ä»£ç ,进行优化和生æˆçš„ 低级别的解决方案,从而使Phalcon实现最大的性能。 Why? ---- * The use of frameworks has become mandatory in professional development with PHP * 框架æä¾›äº†ç»“构化的ç†å¿µï¼Œä»¥è½»æ¾ç»´æŠ¤é¡¹ç›®ï¼Œç¼–写更少的代ç ,使工作å˜å¾—更有趣 Inner workings of PHP? ---------------------- * PHP是一ç§åЍæ€çš„和弱å˜é‡ç±»åž‹è¯è¨€ã€‚æ¯æ¬¡ä¸€ä¸ªäºŒè¿›åˆ¶è¿ç®—(例如,2+“2â€ï¼‰ï¼ŒPHP就会检查æ“作数的类型æ¥è¿›è¡Œç±»åž‹è½¬æ¢ * PHP是解释型è¯è¨€ã€‚主è¦çš„缺点是性能上的æŸå¤± * æ¯ä¸€ä¸ªè¯·æ±‚,它必须首先解释. * 如果ä¸ä½¿ç”¨å—节ç 缓å˜ï¼ˆå¦‚APCï¼‰ï¼Œåˆ™ä»»ä½•æ—¶é—´çš„ä»»ä½•ä¸€ä¸ªè¯·æ±‚å®ƒéƒ½ä¼šè¿›è¡Œè¯æ³•检查 How traditional PHP frameworks work? ------------------------------------ * Many files with classes and functions are read on every request made. Disk reading is expensive in terms of performance, especially when the file structure includes deep folders * Modern frameworks use lazy loading (autoload) to increase performance (for load and execute only the code needed) * Continuous loading or interpreting is expensive and impacts performance * The framework code does not change very often, therefore an application needs to load and interpret it every time a request is made How does a PHP C-extension work? -------------------------------- * C extensions are loaded together with PHP one time on the web server's daemon start process * Classes and functions provided by the extension are ready to use for any application * The code isn't interpreted because is already compiled to a specific platform and processor How does Phalcon work? ---------------------- * Components are loosely coupled. With Phalcon, nothing is imposed on you: you're free to use the full framework, or just some parts of it as a glue components. * Low-level optimizations provides the lowest overhead for MVC-based applications * Interact with databases with maximum performance by using a C-language ORM for PHP * Phalcon directly accesses internal PHP structures optimizing execution in that way as well Conclusion ---------- Phalcon is an effort to build the fastest framework for PHP. You now have an even easier and robust way to develop applications without be worrying about performance. Enjoy!