1

关于在 zend 框架的控制器文件中包含一些头信息的问题。我想包括苹果图标。从这里开始:http: //gigaom.com/apple/how-to-create-ios-device-home-screen-icons-for-web-sites/

但是,当我查看该页面的实际来源时,“尺寸”块没有出现。我假设 rel 和 href 已经是 zend 框架的本机了。如何让“尺寸”显示出来?

$this->view->headLink(array('rel' => 'apple-touch-icon', 'href' => '/images/icons/apple-touch-icon.png'));
    $this->view->headLink(array('rel' => 'apple-touch-icon', 'sizes' => '72x72', 'href' => '/images/icons/apple-touch-icon-72x72.png'));
    $this->view->headLink(array('rel' => 'apple-touch-icon', 'sizes' => '114x114', 'href' => '/images/icons/apple-touch-icon-114x114.png'));

这是在标题中查看页面源时实际显示的内容。

<link href="/images/icons/apple-touch-icon.png" rel="apple-touch-icon" />
<link href="/images/icons/apple-touch-icon-72x72.png" rel="apple-touch-icon" />
<link href="/images/icons/apple-touch-icon-114x114.png" rel="apple-touch-icon" />

谢谢

4

1 回答 1

4

sizes和任何其他不支持开箱即用的属性headLink()应该放在一个extras数组中,如下所示:

$this->view->headLink(array('rel' => 'apple-touch-icon', 
    'href' => '/images/icons/apple-touch-icon.png'));

$this->view->headLink(array('rel' => 'apple-touch-icon', 
    'href' => '/images/icons/apple-touch-icon-72x72.png', 
    'extras' => array('sizes' => '72x72')));

$this->view->headLink(array('rel' => 'apple-touch-icon', 
    'href' => '/images/icons/apple-touch-icon-114x114.png', 
    'extras' => array('sizes' => '114x114')));

(为清楚起见,换行。)

于 2012-07-25T17:41:09.977 回答