本文整理汇总了PHP中Silex\ControllerCollection::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ControllerCollection::get方法的具体用法?PHP ControllerCollection::get怎么用?PHP ControllerCollection::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Silex\ControllerCollection
的用法示例。
在下文中一共展示了ControllerCollection::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRoutes
protected function addRoutes(ControllerCollection $c)
{
$c->method('GET|POST');
$c->match('/editcontent/{contenttypeslug}/{id}', 'edit')->bind('editcontent')->assert('id', '\\d*')->value('id', '');
$c->get('/overview/{contenttypeslug}', 'overview')->bind('overview');
$c->get('/relatedto/{contenttypeslug}/{id}', 'related')->bind('relatedto')->assert('id', '\\d*');
}
示例2: addRoutes
protected function addRoutes(ControllerCollection $c)
{
$c->get('/login', 'getLogin')->bind('login');
$c->post('/login', 'postLogin')->bind('postLogin');
$c->match('/logout', 'logout')->bind('logout');
$c->get('/resetpassword', 'resetPassword')->bind('resetpassword');
}
示例3: addRoutes
protected function addRoutes(ControllerCollection $c)
{
$c->get('/changelog', 'changeOverview')->bind('changelog');
$c->get('/changelog/{contenttype}/{contentid}/{id}', 'changeRecord')->assert('id', '\\d*')->bind('changelogrecordsingle');
$c->get('/changelog/{contenttype}/{contentid}', 'changeRecordListing')->value('contentid', '0')->value('contenttype', '')->bind('changelogrecordall');
$c->get('/systemlog', 'systemOverview')->bind('systemlog');
}
示例4: addRoutes
protected function addRoutes(ControllerCollection $controllers)
{
$controllers->get('/users/new', array($this, 'newAction'))->bind('user_new');
$controllers->post('/users/new', array($this, 'handleNewAction'))->bind('user_new_handle');
$controllers->get('/users/choose', array($this, 'chooseAction'))->bind('user_choose');
$controllers->get('/users/{name}', array($this, 'showAction'))->bind('user_show');
}
示例5: addRoutes
protected function addRoutes(ControllerCollection $controllers)
{
$controllers->get('/tokens', array($this, 'indexAction'))->bind('user_tokens');
$controllers->get('/tokens/new', array($this, 'newAction'))->bind('user_tokens_new');
$controllers->post('/tokens/new', array($this, 'newAction'))->bind('user_tokens_new_process');
$controllers->post('/tokens/{token}/delete', array($this, 'deleteAction'))->bind('user_tokens_delete');
}
示例6: connect
public function connect(Application $app)
{
$this->app = $app;
// api v1
$api = new ControllerCollection(new Route());
$api->get('/{model}', __CLASS__ . '::listAction')->assert('model', '^([a-z]+)$');
$api->get('/{model}/{id}', __CLASS__ . '::itemAction')->assert('model', '^([a-z]+)$')->assert('id', '^([a-z0-9]+)$');
$api->delete('/{model}/{id}', __CLASS__ . '::deleteAction')->assert('model', '^([a-z]+)$')->assert('id', '^([a-z0-9]+)$');
$api->put('/{model}/{id}', __CLASS__ . '::updateAction')->assert('model', '^([a-z]+)$')->assert('id', '^([a-z0-9]+)$');
$api->post('/{model}', __CLASS__ . '::createAction')->assert('model', '^([a-z]+)$');
// $model = $this->checkModel('message');
//
// foreach (range(900, 1000) as $id)
// {
// $message = new $model;
//
// $message->text = $id;
// $message->date = time();
//
// $this->dm->persist($message);
// }
//
// $this->dm->flush();
return $api;
}
示例7: connect
public function connect(Application $app)
{
$controllers = new ControllerCollection();
$controllers->get('auth', function () use($app) {
if ($app['session']->has($app['config']['prefix'] . 'authed-user')) {
return $app->redirect('/');
}
return $app['twig']->render('PT/pages/authenticate.html', array('auth_path' => $app['uri']->generate('authenticate')));
})->bind('authenticate');
$controllers->post('auth', function () use($app) {
if ($app['request']->get('username') === $app['config']['authenticate']['username'] && $app['request']->get('password') === $app['config']['authenticate']['password']) {
$userHash = $userHash = sha1($app['config']['authenticate']['username'] . $app['config']['authenticate']['password']);
$currentUser = $app['session']->set($app['config']['prefix'] . 'authed-user', $userHash);
return $app->redirect('/');
} else {
$app['session']->setFlash('error', 'error');
$app['session']->remove($app['config']['prefix'] . 'authed-user');
return $app->redirect($app['uri']->generate('authenticate'));
}
})->bind('do_authenticate');
$controllers->get('deauth', function ($result) use($app) {
$app['session']->remove($app['config']['prefix'] . 'authed-user');
return $app->redirect($app['uri']->generate('authenticate'));
})->value('result', null)->bind('de_authenticate');
return $controllers;
}
示例8: connect
public function connect(Application $app)
{
$controllers = new ControllerCollection();
$supervisor = new API();
$servers = (include __DIR__ . '/../../config.php');
foreach (array_keys($servers) as $server_id) {
$servers[$server_id]['id'] = $server_id;
}
$controllers->get('/list.{_format}', function ($_format) use($supervisor, $app, $servers) {
if ($_format == 'json') {
return $app->json($servers);
} else {
// use a closure to avoid leaking any vars into the template that we don't explicitly want
return call_user_func(function () use($app) {
$url_root = $app['url_generator']->generate('home');
ob_start();
ob_implicit_flush(false);
include __DIR__ . '/../../views/supervisorui.html.php';
return ob_get_clean();
});
}
})->bind('server_list')->value('_format', 'html');
$controllers->get('/details/{server_id}', function ($server_id) use($supervisor, $app, $servers) {
$server_ip = $servers[$server_id]['ip'];
$details = array_merge(array('version' => $supervisor->getSupervisorVersion('127.0.0.1'), 'pid' => $supervisor->getPID('127.0.0.1')), $supervisor->getState('127.0.0.1'), $servers[$server_id]);
return $app->json($details);
});
return $controllers;
}
示例9: addRoutes
protected function addRoutes(ControllerCollection $controllers)
{
$controllers->get('/password/generate', [$this, 'generatePassword']);
$controllers->post('/password/generate', [$this, 'generatePassword']);
$controllers->get('/password/complication', [$this, 'complicationPassword']);
$controllers->get('/secret', [$this, 'secret']);
}
示例10: addRoutes
protected function addRoutes(ControllerCollection $controllers)
{
$controllers->get('/programmers/new', array($this, 'newAction'))->bind('programmer_new');
$controllers->post('/programmers/new', array($this, 'handleNewAction'))->bind('programmer_new_handle');
$controllers->get('/programmers/choose', array($this, 'chooseAction'))->bind('programmer_choose');
$controllers->get('/programmers/{nickname}', array($this, 'showAction'))->bind('programmer_show');
$controllers->post('/programmers/{nickname}/power/up', array($this, 'powerUpAction'))->bind('programmer_powerup');
}
示例11: mount
/**
* {@inheritDoc}
*/
public function mount(ControllerCollection $controllers)
{
$controllers->get('/', [$this, 'indexAction'])->bind('config_index');
$controllers->get('/edit', [$this, 'editAction'])->bind('config_edit');
$controllers->post('/edit', [$this, 'updateAction'])->bind('config_update');
$controllers->get('/repository/{type}/form-fragment/{index}', [$this, 'retrieveRepositoryFormFragmentAction'])->bind('retrieve_repository_form_fragment');
$controllers->post('/config/build', [$this, 'buildAction'])->bind('config_build');
}
示例12: addRoutes
protected function addRoutes(ControllerCollection $controllers)
{
$controllers->get('/nodes', [$this, 'all']);
$controllers->get('/node/{id}', [$this, 'show']);
$controllers->post('/node', [$this, 'create']);
$controllers->put('/node/{id}', [$this, 'update']);
$controllers->delete('/node/{id}', [$this, 'delete']);
}
示例13: setControllerPaths
/**
* @param ControllerCollection $controllers
* @return ControllerCollection
*/
private function setControllerPaths(ControllerCollection $controllers)
{
$controllers->get('/{id}', self::READ_REST_CONTROLLER . ':get');
$controllers->patch('/{id}', self::EDIT_REST_CONTROLLER . ':patch');
$controllers->get('/', self::READ_REST_CONTROLLER . ':search');
$controllers->post('/', self::EDIT_REST_CONTROLLER . ':create');
return $controllers;
}
示例14: addRoutes
protected function addRoutes(ControllerCollection $controllers)
{
$controllers->get('/register', array($this, 'registerAction'))->bind('user_register');
$controllers->post('/register', array($this, 'registerHandleAction'))->bind('user_register_handle');
$controllers->get('/login', array($this, 'loginAction'))->bind('user_login');
$controllers->post('/login_check', array($this, 'longCheckAction'))->bind('user_login_check');
$controllers->get('/logout', array($this, 'logoutAction'))->bind('user_logout');
}
示例15: addRoutes
protected function addRoutes(ControllerCollection $controllers)
{
$controllers->post('/api/users', array($this, 'newAction'));
$controllers->get('/api/users/{name}', array($this, 'showAction'))->bind('api_users_show');
$controllers->get('/api/users', array($this, 'listAction'));
$controllers->put('/api/users/{name}', array($this, 'updateAction'));
$controllers->delete('/api/users/{name}', array($this, 'deleteAction'));
$controllers->match('api/users/{name}', array($this, 'updateAction'))->method('PATCH');
}