【问题标题】:error with url helper, $this->url(array(), 'home'); generate a link like this http///homeurl 帮助程序出错,$this->url(array(), 'home');生成这样的链接 http///home
【发布时间】:2012-02-05 06:12:40
【问题描述】:

url helper 出错,$this->url(array(), 'home');生成这样的链接 http///home

嗨,

我在我的 application.ini 文件中创建了一个自定义路由,如下所示:

resources.router.routes.home.route = /home
resources.router.routes.home.defaults.module = 默认
resources.router.routes.home.defaults.controller = index
resources.router.routes.home.defaults.action = index

在我的主布局中,我想像这样写一个指向我主页的链接

<a href="<?php echo $this->url(array(), 'home'); ?>">Home</a>

但是我进入了生成的 html 文件,
http///home
有人可以帮我以/home,或http//example.com/home,吗?
谢谢

【问题讨论】:

  • 如果只使用 resources.router.routes.home.route = home(不带斜线)会怎样?
  • 你的 baseUrl() 设置是什么?

标签: zend-framework url-helper


【解决方案1】:
$this->baseUrl('/home'); 

应该工作

【讨论】:

  • 没关系,我的资源定义有误
猜你喜欢
  • 2010-11-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-02-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多