本文整理汇总了PHP中Illuminate\Http\Request::isSecure方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::isSecure方法的具体用法?PHP Request::isSecure怎么用?PHP Request::isSecure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::isSecure方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: url
/**
* Return the URL for the file.
*
* @param array $attributes
* @param null $secure
* @return string
*/
public function url(array $attributes = [], $secure = null)
{
if ($secure === null) {
$secure = $this->request->isSecure();
}
return $this->url->to($this->object->publicPath(), $attributes, $secure);
}
示例2: handle
/**
* Enforces the secure attribute for a request
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->isSecure()) {
return redirect()->secure($request->path());
}
return $next($request);
}
示例3: handle
/**
* Removes the secure attribute from a request
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($request->isSecure()) {
return redirect()->to($request->path(), 302, [], false);
}
return $next($request);
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->isSecure() && noah_installed() && site('forceSsl') == '1') {
return redirect($request->path(), 302, [], true);
}
return $next($request);
}
示例5: handle
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if (!$request->isSecure()) {
return $this->redirector->to($request->getRequestUri(), 302, $request->headers->all(), true);
}
return $next($request);
}
示例6: addPortToDomain
/**
* Add the port to the domain if necessary.
*
* @param string $domain
* @return string
*/
protected function addPortToDomain($domain)
{
$secure = $this->request->isSecure();
$port = $this->request->getPort();
if ($secure && $port === 443 || !$secure && $port === 80) {
return $domain;
}
return $domain . ':' . $port;
}
示例7: handle
/**
* Verify the incoming request is via an ssl connection unless its on an approved url
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->isSecure() && env('FORCE_SECURE', 'true')) {
if (strpos($request->path(), 'access-control/') !== 0 && $request->path() !== 'acs' && $request->path() !== 'acs/spark') {
return redirect()->secure($request->path());
}
}
return $next($request);
}
示例8: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (!$request->isSecure() and env('SECURE_COOKIE', false)) {
if (strpos($request->getRequestUri(), '/storage/') === false) {
return redirect()->secure($request->getRequestUri());
}
}
return $next($request);
}
示例9: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if ($this->app->environment() === 'production') {
// for Proxies
Request::setTrustedProxies([$request->getClientIp()]);
if (!$request->isSecure()) {
return redirect()->secure($request->getRequestUri());
}
}
return $next($request);
}
示例10: isSecure
/**
* Determine if the request is over HTTPS.
*
* @return bool
*/
public function isSecure()
{
$isSecure = parent::isSecure();
if ($isSecure) {
return true;
}
if ($this->isHttpsOn()) {
return true;
} elseif ($this->isLoadBalancedHttps()) {
return true;
}
return false;
}
示例11: isSecure
/**
* Checks whether the request is secure or not.
*
* This method can read the client protocol from the "X-Forwarded-Proto" header
* when trusted proxies were set via "setTrustedProxies()".
*
* The "X-Forwarded-Proto" header must contain the protocol: "https" or "http".
*
* If your reverse proxy uses a different header name than "X-Forwarded-Proto"
* ("SSL_HTTPS" for instance), configure it via "setTrustedHeaderName()" with
* the "client-proto" key.
*
* @return bool
* @static
*/
public static function isSecure()
{
//Method inherited from \Symfony\Component\HttpFoundation\Request
return \Illuminate\Http\Request::isSecure();
}
示例12: getIndex
/** Получение адреса сокета
* @param Request $request
* @return mixed
*/
public function getIndex(Request $request)
{
return Tattler::getWs($request->isSecure());
}