本文整理汇总了PHP中Illuminate\Http\Request::enableHttpMethodParameterOverride方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::enableHttpMethodParameterOverride方法的具体用法?PHP Request::enableHttpMethodParameterOverride怎么用?PHP Request::enableHttpMethodParameterOverride使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::enableHttpMethodParameterOverride方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadCompiledAndInitSth
protected function loadCompiledAndInitSth()
{
if (file_exists($this->compiledPath)) {
require $this->compiledPath;
}
// removed from Illuminate\Foundation\Http\Kernel::handle
\Illuminate\Http\Request::enableHttpMethodParameterOverride();
}
示例2: onWorkerStart
public function onWorkerStart($serv, $worker_id)
{
//创建laravel内核(把该逻辑放在此处,确保所有worker创建前父进程副本与laravel无关,令laravel具备热部署特性)
require __DIR__ . '/../bootstrap/autoload.php';
$app = (require __DIR__ . '/../bootstrap/app.php');
$this->laravel_kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
//开启“方法欺骗”特性,与laravel5.1 LTS保持一致
Illuminate\Http\Request::enableHttpMethodParameterOverride();
}
示例3: handle
/**
* Handle an incoming HTTP request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function handle($request)
{
try {
$request->enableHttpMethodParameterOverride();
$response = $this->sendRequestThroughRouter($request);
} catch (Exception $e) {
$this->reportException($e);
$response = $this->renderException($request, $e);
}
$this->app['events']->fire('kernel.handled', [$request, $response]);
return $response;
}
示例4: bootstrap
public static function bootstrap($errorCallbacks)
{
// Only bootstrap once.
if (static::$bootstrapped) {
return;
}
// Load helper functions.
require_once __DIR__ . '/../../../illuminate/support/Illuminate/Support/helpers.php';
// Directories.
$basePath = str_finish(realpath(__DIR__ . '/..'), '/');
$controllersDirectory = $basePath . 'Controllers';
$modelsDirectory = $basePath . 'Models';
// Register the autoloader and add directories.
ClassLoader::register();
ClassLoader::addDirectories(array($controllersDirectory, $modelsDirectory));
// Instantiate the container.
$app = new Container();
static::$container = $app;
// Tell facade about the application instance.
Facade::setFacadeApplication($app);
// Register application instance with container
$app['app'] = $app;
// Set environment.
$app['env'] = 'production';
// Enable HTTP Method Override.
Request::enableHttpMethodParameterOverride();
// Create the request.
$app['request'] = Request::createFromGlobals();
// Register services.
with(new EventServiceProvider($app))->register();
with(new RoutingServiceProvider($app))->register();
// Register aliases.
foreach (static::$aliases as $alias => $class) {
class_alias($class, $alias);
}
// Load the routes file if it exists.
if (file_exists($basePath . 'routes.php')) {
require_once $basePath . 'routes.php';
}
// Dispatch on shutdown.
register_shutdown_function('Seytar\\Routing\\Router::dispatch', $errorCallbacks);
// Mark bootstrapped.
static::$bootstrapped = true;
}
示例5: createApplication
/**
* Creates the application.
*
* Needs to be implemented by subclasses.
*
* @return \Symfony\Component\HttpKernel\HttpKernelInterface
*/
public function createApplication()
{
$app = new Application();
$app->detectEnvironment(array('local' => array('your-machine-name')));
$app->bindInstallPaths($this->getApplicationPaths());
$app['env'] = 'testing';
$app->instance('app', $app);
Facade::clearResolvedInstances();
Facade::setFacadeApplication($app);
$app->registerCoreContainerAliases();
with($envVariables = new EnvironmentVariables($app->getEnvironmentVariablesLoader()))->load($app['env']);
$app->instance('config', $config = new Repository($app->getConfigLoader(), $app['env']));
$app->startExceptionHandling();
date_default_timezone_set($this->getApplicationTimezone());
$aliases = array_merge($this->getApplicationAliases(), $this->getPackageAliases());
AliasLoader::getInstance($aliases)->register();
Request::enableHttpMethodParameterOverride();
$providers = array_merge($this->getApplicationProviders(), $this->getPackageProviders());
$app->getProviderRepository()->load($app, $providers);
$this->registerBootedCallback($app);
return $app;
}
示例6: enableHttpMethodParameterOverride
/**
* Enables support for the _method request parameter to determine the intended HTTP method.
*
* Be warned that enabling this feature might lead to CSRF issues in your code.
* Check that you are using CSRF tokens when required.
* If the HTTP method parameter override is enabled, an html-form with method "POST" can be altered
* and used to send a "PUT" or "DELETE" request via the _method request parameter.
* If these methods are not protected against CSRF, this presents a possible vulnerability.
*
* The HTTP method can only be overridden when the real HTTP method is POST.
*
* @static
*/
public static function enableHttpMethodParameterOverride()
{
//Method inherited from \Symfony\Component\HttpFoundation\Request
return \Illuminate\Http\Request::enableHttpMethodParameterOverride();
}
示例7:
| is bound in the application since it contains the alias definitions.
|
*/
$aliases = $config['aliases'];
AliasLoader::getInstance($aliases)->register();
/*
|--------------------------------------------------------------------------
| Enable HTTP Method Override
|--------------------------------------------------------------------------
|
| Next we will tell the request class to allow HTTP method overriding
| since we use this to simulate PUT and DELETE requests from forms
| as they are not currently supported by plain HTML form setups.
|
*/
Request::enableHttpMethodParameterOverride();
/*
|--------------------------------------------------------------------------
| Register The Core Service Providers
|--------------------------------------------------------------------------
|
| The Illuminate core service providers register all of the core pieces
| of the Illuminate framework including session, caching, encryption
| and more. It's simply a convenient wrapper for the registration.
|
*/
$providers = $config['providers'];
$app->getProviderRepository()->load($app, $providers);
/*
|--------------------------------------------------------------------------
| Register Booted Start Files
示例8: handle
/**
* Handle an incoming HTTP request.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function handle($request)
{
$request->enableHttpMethodParameterOverride();
$this->sendRequestThroughRouter($request);
return $this;
}