2017-05-17 4 views
0

を働いていない私はslimphpルータと少し問題があります。GET 1/API /ライブラリ/ブック/に送信Slimphp 3ネストされたグループは

$app->group('/api', function() use ($app) { 

    // Library group 
    $this->group('/library', function() use ($app) { 

     // Get book with ID 
     $this->get('/books/:id', function ($req, $res) { 
      echo "books"; 
     }); 

     // Update book with ID 
     $this->put('/books/:id', function ($req, $res) { 

     }); 

     // Delete book with ID 
     $this->delete('/books/:id', function ($req, $res) { 

     }); 

    }); 

}); 

を私に問題があるPage not foundエラーを与えます。

EDIT:

の.htaccess

RewriteEngine On 

# Some hosts may require you to use the `RewriteBase` directive. 
# If you need to use the `RewriteBase` directive, it should be the 
# absolute physical path to the directory that contains this htaccess file. 
# 
# RewriteBase/

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [QSA,L] 

PS:シンプルapp->get

+0

で発見

$this->get('/books/{id}', function ($request, $response, $args) { ... }); 

だろうあなたはスリム2またはスリム3を使用していますか?あなたはそれぞれからコードを混ぜているようです。 – meun5

+0

私はスリム3を使用しています – karim

+0

あなたのウェブサーバーの設定(つまり.htaccess)を追加できますか? – meun5

答えて

0

それはスリムとない:id、プレースホルダとして{id}スリムとして3つの用途が見つからない、何の問題もなく働いています2はしました。したがって、コードがSlim 3 Documentation for Route Placeholders

関連する問題