*/ $di->set('dispatcher', function () { return include "dispatcher.php"; }, true); /* * 设置redis */ $di->set("redis", function () { return new myRedis(); }, true); $di->set("carbon", function () { return new \Carbon\Carbon(); }, true); $di->set("myTools", function () use($config) { $tools = new myTools(); $tools->setSiteName($config->siteName); return $tools; }, true); /* * 为什么在volt中不能够直接引用呢?奇怪!! * 是因为使用静态调用导致的吗? */ $di->set("allTags", function () { return new Tags(); }, true); /* * 设置Event Manager */ $di->set('Event', function () { return include 'events.php'; }, true);