为什么Kohana 3.0升级到3.1后Request::current()为空?


Why is Request::current() null after upgrade from Kohana 3.0 to 3.1?

我们将Kohana框架从3.0升级到3.1,因此在bootstrap.php文件中我必须更改:

request = Request::instance($_SERVER['PATH_INFO']);

$request = Request::current(); 

但是现在$request总是null

我要做什么改变,使Request::current()返回一个请求而不是null?

您需要调用Request::factory()来创建初始请求对象。Request::current()不创建新请求,只返回当前。

还需要更改index.php和bootstrap.php文件,因为请求执行被移到了index.php中。

p 。也许这个链接会有帮助。