php - headMeta -appendName 或appendHttpEquiv

标签 php zend-framework

headMeta() 的appendName() 和appendHttpEquiv() 方法有什么区别?例如,keywords 是与 Name 或 http-equiv 一起使用吗?

$view->headMeta()->appendHttpEquiv('keywords', 'keys');
or 
$view->headMeta()->appendName('keywords', 'keys');

最佳答案

区别在于

$view->headMeta()->appendHttpEquiv('keywords', 'keys');

创建

<meta http-equiv="keywords" content="keys" >

同时

$view->headMeta()->appendName('keywords', 'keys');

创建

<meta name="keywords" content="keys" >

According to the W3C specs

http-equiv may be used in place of the name attribute. HTTP servers use this attribute to gather information for HTTP response message headers.

XHTML2.0 specs对此有更多描述:

HTTP-EQUIV binds the element to an HTTP header field. An HTTP server may use this information to process the document. In particular, it may include a header field in the responses to requests for this document: the header name is taken from the HTTP-EQUIV attribute value, and the header value is taken from the value of the CONTENT attribute. HTTP header names are not case sensitive.

NAME specifies the name of the name/value pair. If not present, HTTP-EQUIV gives the name.

由于您不太可能在 header 中发送关键字,因此使用名称是正确的方法。

关于php - headMeta -appendName 或appendHttpEquiv,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3942007/

相关文章:

zend-framework - zend view helper 配置路径(在 bootstrap 中有效但在 application.ini 中无效)?

model-view-controller - 在 Zend Framework 应用程序中,/views/filters 的作用是什么?

php - 在 PHP Core 中将现有字符串日期转换为 'm/j/Y'

php - Laravel 更快地查询 Controller 或 View 中的所有内容

PHP 数组键存在于字符串中

zend-framework - Zend 搜索 Lucene 和波斯语!

php - 更改 Zend 图片验证码样式

php - 为什么 mySQL 语句对于适用于 print 或 echo 语句的比较会抛出解析错误?

php - 将 aws/aws-sdk-php 与谷歌云存储一起使用

php - 投票按钮的数据库设计