如何在 silex 框架中调用另一条路由


How to Call Another Route in Silex Framework

我正在使用Silex框架,需要调用

$app->get('/users/')

里面

$app->get('/user/create/{username}'

创建新用户后。我该怎么做?

以下是我的示例代码:

$app->get('/users/', function(Application $app) {
  ....
});
$app->get('/user/create/{username}', function(Application $app, $username) {
  ....
  **redirect to  $app->get('/users/')**
});

得到了答案!

return $app->redirect('/users/');