最近有在玩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)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号