Zend Framework HTTPS URL [英] Zend Framework HTTPS URL

查看:119
本文介绍了Zend Framework HTTPS URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有更多或更少的标准方法来指定使用明确指定的方案创建URL的路由?

Is there any more or less standard way to specify a route that would create URL's with explicitly specified scheme?

我已经尝试了指定的解决方案这里但由于以下几个原因,它并不适合我:

I've tried the solution specified here but it's not excellent for me for several reasons:


  1. 它不支持基本网址请求属性。实际上,当显式指定URL方案时,重写路由器会忽略它。

  2. 需要为每个与方案相关的URL指定单独的静态路由(由于base而无法使用主机名路由链接模块路由url被忽略)。

  3. 只要在FrontController中不存在请求对象,就需要在bootstrap中的路由器初始化时手动确定HTTP_HOST。


推荐答案

使用ServerUrl和Url视图助手的组合来构建您的URL,例如(查看上下文)

Use a combination of the ServerUrl and Url view helpers to construct your URLs, eg (view context)

<?php $this->getHelper('ServerUrl')->setScheme('https') ?>
...
<a href="<?php echo $this->serverUrl($this->url(array(
    'url' => 'params'), 'route', $reset, $encode)) ?>">My Link</a>

这篇关于Zend Framework HTTPS URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆