本文整理汇总了PHP中Slim\Http\Request::post方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::post方法的具体用法?PHP Request::post怎么用?PHP Request::post使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Slim\Http\Request
的用法示例。
在下文中一共展示了Request::post方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureAction
/**
* @Route /configuration/configure
*/
public function configureAction(\Slim\Http\Request $request)
{
$parameters = array();
$parameters['database'] = array();
$parameters['database']['driver'] = $request->post('driver');
$parameters['database']['dbname'] = '';
$parameters['database']['user'] = $request->post('user');
$parameters['database']['port'] = $request->post('port');
$parameters['database']['password'] = $request->post('password');
$parameters['database']['host'] = $request->post('host');
$parameters['raptor'] = array();
$parameters['raptor']['language'] = $request->post('lang');
$parameters['raptor']['secret'] = $request->post('secret');
$parameters['raptor']['cache'] = $request->post('cache');
$this->app->getConfigurationLoader()->setConfOption($parameters);
$this->getStore()->connect();
$this->getStore()->generateDatabase($request->post('db'));
$parameters['database']['dbname'] = $request->post('db');
$this->app->getConfigurationLoader()->setConfOption($parameters);
$this->app->getConfigurationLoader()->writeOptions();
$this->app->getConfigurationLoader()->forceLoad();
// $parameters['database']['password'] = '???';
// $this->app->getConfigurationLoader()->setConfOption($parameters);
// $this->app->getConfigurationLoader()->writeOptions();
return $this->render('@systemBundle/configure/parameter.html.twig');
}
示例2: __construct
/**
* @param View $view
* @param Request $request
* @param UserRepository $userRepository
* @param Session $session
* @param Redirector $redir
*/
public function __construct(View $view, Request $request, UserRepository $userRepository, Session $session, Redirector $redir)
{
$this->view = $view;
$this->username = $request->post('username');
$this->password = $request->post('password');
$this->userRepository = $userRepository;
$this->session = $session;
$this->redir = $redir;
}
示例3: __construct
/**
* @param Request $request
* @param UserRepository $userRepository
* @param Redirector $redirector
*/
public function __construct(Request $request, UserRepository $userRepository, Redirector $redirector)
{
$this->dispname = $request->post('dispname');
$this->username = $request->post('username');
$this->password = $request->post('password');
$this->phone = $request->post('phone');
$this->userRepository = $userRepository;
$this->redirector = $redirector;
}
示例4: get
public function get($name)
{
$value = $this->request->get($name);
if ($value === null) {
$value = $this->request->post($name);
}
if ($value === null) {
$value = @$this->defaultValues[$name];
}
return $value;
}
示例5: configureAction
/**
* Add your definition route and the name route[optional]
*
* @Route /configure/configure
*
*
* @param \Slim\Http\Request $request
* @param \Slim\Http\Response $response
* @param \Slim\Route $route
*/
public function configureAction($request, $response, $route)
{
$this->constructServiceFile();
$wsdlGenerator = new PHPClass2WSDL('Raptor2\\ServiceBundle\\Soap\\Service', $request->post('uri'));
$wsdlGenerator->generateWSDL(FALSE);
$actual = $wsdlGenerator->dump();
$dirClass = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'Soap';
file_put_contents($dirClass . DIRECTORY_SEPARATOR . 'wsdl' . DIRECTORY_SEPARATOR . 'service.wsdl', $actual);
$this->app->getConfigurationLoader()->setConfOption(array('raptor' => array('services' => $request->post('uri'))));
$this->app->getConfigurationLoader()->writeOptions();
$this->app->getConfigurationLoader()->forceLoad();
return $this->render('@ServiceBundle/configure/parameter.html.twig');
}
示例6: createBundleAction
/**
* @Route /genbundle/create
* @param \Slim\Http\Request $request
*/
public function createBundleAction($request)
{
$bundleName = $request->post('bundle');
$bundleName .= 'Bundle';
$messages = new ItemList();
if (!$this->createBundleDirectory($request->post('vendor'), $bundleName, $messages)) {
return $this->show("Sorry cannot create the Bundle directory", true, Controller::ERROR);
}
$this->createFiles($bundleName, $request->post('definition'), $request->post('vendor'), $messages);
$this->app->getConfigurationLoader()->registerBundle($request->post('definition') . '\\' . $bundleName);
$resp = array();
$messages->each(function ($key, $value) use(&$resp) {
$resp[] = array('msg' => $value);
});
$resp = array('response' => $resp);
$this->app->getConfigurationLoader()->forceLoad();
return $this->show("Bundle created", true, Controller::INFO, $resp);
}
示例7: __construct
protected function __construct(\Slim\Http\Request $request)
{
$key = $request->headers('apikey');
if ($key == '') {
$key = $request->post('apikey');
}
if ($key == '') {
$key = $request->get('apikey');
}
if ($key == '') {
return;
}
$this->apiKey = $key;
$this->role = $this->getRoleFromKey($this->apiKey);
}
示例8: extractToken
public function extractToken(Request $request)
{
$tokenHeader = $request->headers('Authorization', false);
$rawTokenHeader = $request->rawHeaders('Authorization', false);
if ($tokenHeader && preg_match('/Bearer\\s*([^\\s]+)/', $tokenHeader, $matches)) {
$tokenHeader = $matches[1];
} elseif ($rawTokenHeader && preg_match('/Bearer\\s*([^\\s]+)/', $rawTokenHeader, $matches)) {
$tokenHeader = $matches[1];
} else {
$tokenHeader = false;
}
$tokenRequest = $request->post('access_token', false);
$tokenQuery = $request->get('access_token', false);
// At least one (and only one) of client credentials method required.
if (!$tokenHeader && !$tokenRequest && !$tokenQuery) {
throw new Exception('The request is missing a required parameter.', Resource::STATUS_BAD_REQUEST);
} elseif ($tokenHeader && $tokenRequest || $tokenRequest && $tokenQuery || $tokenQuery && $tokenHeader) {
throw new Exception('The request includes multiple credentials.', Resource::STATUS_BAD_REQUEST);
}
$accessToken = $tokenHeader ?: $tokenRequest ?: $tokenQuery;
try {
$tokenDocument = $this->fetchToken($accessToken);
} catch (\Exception $e) {
throw new Exception('Access token invalid.');
}
return $tokenDocument;
}
示例9: __invoke
public function __invoke()
{
$title = $this->request->post('gamename');
$this->gameRepository->createGameUnsafe($title, $this->currentUser);
$this->redirector->redirect(303, '/games');
}
示例10: getSlimView
public function getSlimView(\Slim\Http\Request $request)
{
if ($request->isAjax() || $request->isXhr() || $request->get('format', '') == 'json' || $request->post('format', '') == 'json') {
return $this->slimViewFactory->getJsonSlimView();
}
return $this->slimViewFactory->getHtmlSlimView();
}