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" >
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/