为什么从 Kohana 3.0 升级到 3.1 后 Request::current() 为 null?
我们将 Kohana 框架从 3.0 升级到 3.1,因此在 bootstrap.php 文件中我必须将其更改为:
request = Request::instance($_SERVER['PATH_INFO']);
但
$request = Request::current();
现在 $request 始终为 null。
我需要更改什么才能使 Request::current()
返回请求而不是 null?
We upgraded our Kohana framework from 3.0 to 3.1 and so in the bootstrap.php file I had to change:
request = Request::instance($_SERVER['PATH_INFO']);
to
$request = Request::current();
but now $request is always null.
What do I have to change so that Request::current()
returns a request instead of null?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要调用
Request::factory()
来创建初始 Request 对象。Request::current()
不会创建新请求,只是返回当前请求。另外,您需要更改index.php和bootstrap.php文件,因为请求执行 被移至index.php。
附注。也许此链接会有所帮助。
You need call
Request::factory()
to create initial Request object.Request::current()
doesnt create new request, just returns current.Also, you need to change your index.php and bootstrap.php files, because Request execution was moved into index.php.
PS. Maybe this link will helps.