navy92f 发表于 2010-6-14 11:40:45

发现两段有意思的代码:140字的框架,140字的依赖注入容器

140字的框架:非常巧妙了
////////////////////////////////////
require __DIR__.'/c.php';
if (!is_callable($c = @$_GET['c'] ?: function() { echo 'Woah!'; }))
throw new Exception('Error');
$c();
介绍:http://twitto.org/
///////////////////////////////////////

140字的依赖注入容器:
class Container {
protected $s=array();
function __set($k, $c) { $this->s[$k]=$c; }
function __get($k) { return $this->s[$k]($this); }
}

介绍:http://twittee.org/
哪位能告诉我,return $this->s[$k]($this)最后的($this)是什么意思?

外国人怎么这么有钱呢?一个小东西,还得买个域名,不便宜啊。
好像是投资域名吧,名字都很好呢。

kkk 发表于 2010-6-14 21:53:47

国外的程序员就是有创意

visvoy 发表于 2010-6-15 00:03:50

好玩,不过对php版本要求高了点要5.3:P
页: [1]
查看完整版本: 发现两段有意思的代码:140字的框架,140字的依赖注入容器