使用rel =“next”rel =“prev”HTTP标头的分页SEO(SEO of Pagination using rel=“next” rel=“prev” HTTP Headers)
我试图在网站上的分页控件上执行一些搜索引擎优化。
遵循Google指南 ,我想将链接rel = next / prev即
<link href="/search/results?page=2" rel="next" />
到我的搜索结果页面的<head>
。不幸的是,由于MVC3的设计决策/限制以及渲染部分和在Partials中定义其内容 ,我无法做到这一点。
所以我的问题是 - 我可以通过添加“链接”HTTP标头来复制上述功能,即
Link: <http://www.example.com/search/results?page=2>; rel="next"
Link: <http://www.example.com/search/results?page=2>; rel="next"
到响应,因此不必在<head>
添加<link>
标签?I am trying to perform some SEO on a pagination control I have on a website.
Following the Google guidelines, I would like to add link rel=next/prev i.e.
<link href="/search/results?page=2" rel="next" />
to the<head>
of my search results page.Unfortunatley, due to a design decision / limitation of MVC3 with rendering sections and defining their content within Partials, I'm unable to do this.
So my question is - can I replicate the aforementioned functionality by adding a "Link" HTTP header, i.e.
Link: <http://www.example.com/search/results?page=2>; rel="next"
to the response and therefore not have to add the<link>
tags in the<head>
?
原文:https://stackoverflow.com/questions/7586361
最满意答案
改用
microtime(true)
。$time = microtime(true); $micro = $time - floor($time); // microseconds part
Use
microtime(true)
instead.$time = microtime(true); $micro = $time - floor($time); // microseconds part
相关问答
更多-
E-5是科学记数法。 似乎在将它与字符串值连接时发生。 尝试使用number_format ...? print "Time4: ". number_format($end4 - $start4, 10)."
"; //or use: printf(".10f", $end - $start) E-5 is scientific notation. Seems to happen when you concatenate it with the string val ... -
在PHP中, microtime实际上为您提供了微秒分辨率的一秒。 JavaScript使用毫秒而不是秒作为其时间戳,因此您只能获得具有毫秒分辨率的分数部分。 但要得到这个,你只需要取时间戳,除以1000并得到余数,如下所示: var microtime = (Date.now() % 1000) / 1000; 为了更完整地实现PHP功能,您可以执行以下操作(从PHP.js缩写 ): function microtime(getAsFloat) { var s, now = (D ...
-
PHP microtime()(PHP microtime())[2022-12-14]
改用microtime(true) 。 $time = microtime(true); $micro = $time - floor($time); // microseconds part Use microtime(true) instead. $time = microtime(true); $micro = $time - floor($time); // microseconds part -
如果要对由microtime返回的操作进行操作,则必须将“get as float”参数设置为true(默认为false)。 http://www.php.net/manual/en/function.microtime.php $now = microtime(true); for (...) { // do something echo microtime(true) - $now; $now = microtime(true); } If you want to do ope ...
-
即使需要几微秒(是的,它的文件必须被解析,对吗?!),你不应该删除它们。 首先要做的是缓存字节代码,因此PHP解释器不必将“纯文本”代码重新解析为字节代码。 我认为你可以从中获得更多的性能提升,而不是担心评论会占用解析时间。 这个帖子似乎确实是重复的 。 (请注意自己,首先在提交前刷新页面。) Even if it takes some microseconds (yes it will, your file has to be parsed, right?!), you shouldn't remove ...
-
没有直接的等价物,但可以很容易地实现......由于UNIX时间戳是自1970年1月1日以来的秒数,因此很容易计算: public readonly DateTime UnixEpoch = new DateTime(1970, 1, 1); // equivalent to PHP mktime : public int GetUnixTimestamp(DateTime dt) { TimeSpan span = dt - UnixEpoch; return (int)span.Tot ...
-
microtime - 以微秒为单位返回当前的Unix时间戳 混合microtime([bool $ get_as_float = false]) 改为: $time = microtime(true); echo microtime(true) - $time; 结果将在几秒钟内完成。 检查此(手动): 'time1'=>浮动1360860136.6731 'time2'=>浮点数1360860136.6732和 'time2' - 'time1'= 9.9897384643555E-5即0.00009 ...
-
浮点数中显示的位数由PHP.ini文件中的精度设置控制。 它的默认值是14 ,这正是你在下面看到的位数: 1419714319.0506 // 10 digits before, 4 after decimal, 14 total 将此设置更改为更大的数字:: ini_set("precision", 20); $t = microtime(true); var_dump($t); // float(1419716734.0712089539) 请注意,这只能控制显示的位数,不会影响计算。 说了这么多, ...
-
没有使用日期格式化程序的解决方案 - 自己完成所有操作: $minutes = floor($time / 60); $seconds = $time % 60; $minutes = str_pad($minutes, 2, '0', STR_PAD_LEFT); $seconds = str_pad($seconds, 2, '0', STR_PAD_LEFT); echo "Process Time: $minutes:$seconds"; 注意:如果分钟数等于或大于60,这也有效。即使您的分钟 ...
-
microtime()的准确度如何?(How accurate is microtime()?)[2023-02-13]
你在说什么是剖析。 虽然可以“自己动手”,(并且你在这方面走的是正确的道路),但是有很多有用的东西会为你做繁重的工作。 如果你愿意,你可以随时做你建议的事情并通过循环测试的多次迭代来消除偏差,但是如果你想全面分析你的所有PHP我推荐这个问题的“xdebug”答案: 最简单的方法配置PHP脚本 它对我很有用。 What you are talking about is profiling. Although it is possible to "roll your own", (and you are on ...