【问题标题】:Kohana module restify URLKohana 模块重置 URL
【发布时间】:2012-04-19 18:32:50
【问题描述】:

您好,我正在尝试使用此模块 ->

http://kohana-modules.com/modules/michealmorgan/kohana-restify

它很好用,除非我使用 curl 发送请求,如果我发送这个

localhost/restify/test?id=1 然后我得到 id 的值

如果我这样做

localhost/restify/test/1 或 localhost/restify/test/index/1 我被路由到默认页面(错误页面)

所以我假设 Index 被映射到 GET ,所以任何不是 test/index 的东西都会被路由,但我不知道如何让它接受它。

有人解决了吗?

谢谢

if (trim(Request::detect_uri(), '/') == 'restify/test')
{
Route::set('restify/test', '<directory>(/<controller>(/<action>(id/<id>)))')
->defaults(array
(
'directory'     => 'restify', 
'controller'    => 'test'

【问题讨论】:

  • 您必须向我们展示您的 bootstrap.php,否则我们无法为您提供帮助。
  • 就是这样,我不认为它是引导程序,因为一旦模块看到 GET 它就会索引其他任何东西,例如 index/44 被发送到默认页面。这里是。 if (trim(Request::detect_uri(), '/') == 'restify/test') { Route::set('restify/test', '(/(/( id/)))') ->defaults(array ('directory' => 'restify', 'controller' => 'test')); }

标签: rest module kohana


【解决方案1】:

尝试将其插入您的引导程序中...

echo Debug::vars(trim(Request::detect_uri(), '/'));

如果在 curl 请求时它不等于 restify/test,则说明有问题,您可能需要修复模块

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多