Home > php教程 > php手册 > PHP框架的Controller

PHP框架的Controller

WBOY
Release: 2016-06-13 10:48:02
Original
2076 people have browsed it

最近有在玩SAE网络营销培训(新浪的云计算平台),所以又玩回PHP。打算写个微博的应用的,于是 在写的过程里发现简单的controller机制很容易把代码搞得很混乱。于是就想着改进下控制的方式。以前一直以为controller只需要简单地把 url映射到函数或者其他什么,然后后续的工作就完全不用理了。现在想到另外一种控制:

function boot( $func ) {
   $context = array ();
   while ( $func = $func ( $context )) {
     ;
   }
}
 
boot( function (& $context ) {
   $context [] = 'A' ;
   return function (& $context ) {
     $context [] = 'B' ;
     return function (& $context ) {
       $context [] = 'C' ;
       return function (& $context ) {
         var_dump( $context );
       };
     };
   };
});
?>
以上就是个概念骨架了 (fblww-1230)


摘自 网络营销
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template