本文整理汇总了PHP中Slim\Slim::redirectTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Slim::redirectTo方法的具体用法?PHP Slim::redirectTo怎么用?PHP Slim::redirectTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Slim
的用法示例。
在下文中一共展示了Slim::redirectTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
/**
* @param Slim $app
* @param Resolver $resolver
*/
public function register(Slim $app, Resolver $resolver)
{
$app->get('/', function () use($app) {
$app->redirectTo('transfer_form');
});
$app->get('/transfer-form', $resolver->resolve($app, 'ewallet.transfer_form_controller:showForm', function () {
return [Identifier::fromString('ABC')];
}))->name('transfer_form');
$app->post('/transfer-funds', $resolver->resolve($app, 'ewallet.transfer_funds_controller:transfer', function () use($app) {
/** @var \EwalletModule\Bridges\Zf2\InputFilter\TransferFundsInputFilterRequest $request */
$request = $app->container->get('ewallet.transfer_filter_request');
$request->populate($app->request->post());
return [$request];
}))->name('transfer_funds');
}
示例2: add
/**
* @param string $routeName
* @param string $tableName
* @param callable $customCRUDFunction
* @param string $displayName
*/
public function add($routeName, $customCRUDFunction = null, $tableName = null, $displayName = null)
{
if ($tableName == null) {
$tableName = $routeName;
}
$this->tableList[$routeName] = $tableName;
$this->tableDisplayName[$routeName] = $displayName;
$this->routeNameList[] = $routeName;
/*
* Page Group (ListView, CreateView, EditView)
*/
$this->slim->group("/" . $this->groupName . "/" . $routeName, function () use($routeName, $customCRUDFunction, $tableName) {
$this->slim->get("/", function () use($routeName) {
$this->slim->redirectTo("_louisCRUD_" . $routeName);
});
/*
* ListView
*/
$this->slim->get("/list(/:p1(/:p2(/:p3(/:p4(/:p5)))))", function ($p1 = null, $p2 = null, $p3 = null, $p4 = null, $p5 = null) use($routeName, $customCRUDFunction, $tableName) {
// MUST INIT FIRST
$this->init($tableName, $routeName, $p1, $p2, $p3, $p4, $p5);
if ($this->configFunction != null) {
$function = $this->configFunction;
$result = $function();
if ($result === false) {
return;
}
}
if ($customCRUDFunction != null) {
$result = $customCRUDFunction($p1, $p2, $p3, $p4, $p5);
if ($result === false) {
return;
}
}
if ($this->listviewFunction != null) {
$listviewFunction = $this->listviewFunction;
$result = $listviewFunction($p1, $p2, $p3, $p4, $p5);
if ($result === false) {
return;
}
}
if ($this->isEnabledListView()) {
$this->renderListView();
}
})->name("_louisCRUD_" . $routeName);
/*
* Create
*/
$this->slim->get("/create(/:p1(/:p2(/:p3(/:p4(/:p5)))))", function ($p1 = null, $p2 = null, $p3 = null, $p4 = null, $p5 = null) use($routeName, $customCRUDFunction, $tableName) {
// MUST INIT FIRST
$this->init($tableName, $routeName, $p1, $p2, $p3, $p4, $p5);
if ($this->configFunction != null) {
$function = $this->configFunction;
$result = $function();
if ($result === false) {
return;
}
}
if ($customCRUDFunction != null) {
$result = $customCRUDFunction($p1, $p2, $p3, $p4, $p5);
if ($result === false) {
return;
}
}
if ($this->createFunction != null) {
$createFunction = $this->createFunction;
$result = $createFunction($p1, $p2, $p3, $p4, $p5);
if ($result === false) {
return;
}
}
// Force Hide ID field
$this->field("id")->hide();
if ($this->isEnabledCreate()) {
$this->renderCreateView();
}
});
/*
* Edit
*/
$this->slim->get("/edit/:id(/:p1(/:p2(/:p3(/:p4(/:p5)))))", function ($id, $p1 = null, $p2 = null, $p3 = null, $p4 = null, $p5 = null) use($routeName, $customCRUDFunction, $tableName) {
// MUST INIT FIRST
$this->init($tableName, $routeName, $p1, $p2, $p3, $p4, $p5);
// Load Bean first
$this->loadBean($id);
// ID must be hidden
$this->field("id")->hide();
if ($this->configFunction != null) {
$function = $this->configFunction;
$result = $function();
if ($result === false) {
return;
}
}
//.........这里部分代码省略.........