WordPress: Function Reference/wp schedule single event:修订间差异
来自站长百科
无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
== 描述== | == 描述== | ||
确定hook的时间,hook会在你规定的时间由WordPress actions core执行。如果预定的时间过去了,有人访问你的WordPress站点,action就会引起。 | 确定hook的时间,hook会在你规定的时间由WordPress actions core执行。如果预定的时间过去了,有人访问你的WordPress站点,action就会引起。 | ||
== 用法 == | == 用法 == | ||
%%% <?php wp_schedule_single_event(time(), 'my_schedule_hook'); ?> %%% | %%% <?php wp_schedule_single_event(time(), 'my_schedule_hook'); ?> %%% | ||
== 例子 == | == 例子 == | ||
=== 确定一个小时后的日程 === | === 确定一个小时后的日程 === | ||
<pre> | <pre> | ||
function do_this_in_an_hour() { | function do_this_in_an_hour() { | ||
第57行: | 第22行: | ||
</pre> | </pre> | ||
== 参数 == | == 参数 == | ||
第65行: | 第28行: | ||
{{Parameter|$hook|string|将要执行的action hook的名称。}} | {{Parameter|$hook|string|将要执行的action hook的名称。}} | ||
{{Parameter|$args|array|将要传递给hook函数的参数|optional}} | {{Parameter|$args|array|将要传递给hook函数的参数|optional}} |
2008年7月28日 (一) 12:03的版本
描述
确定hook的时间,hook会在你规定的时间由WordPress actions core执行。如果预定的时间过去了,有人访问你的WordPress站点,action就会引起。
用法
%%% <?php wp_schedule_single_event(time(), 'my_schedule_hook'); ?> %%%
例子
确定一个小时后的日程
function do_this_in_an_hour() { // 执行操作 } add_action('my_new_event','do_this_in_an_hour'); // 将这一行嵌入函数内部, //响应用户执行的某个操作 //否则,访问一个网页,就会确定新的操作安排wp_schedule_single_event(time()+3600, 'my_new_event'); // time()+3600 = 一个小时后。
参数
Further Reading
深入阅读
For a comprehensive list of functions, take a look at the category Functions
关于完整的函数的列表,请看看[1]
Also, see WordPress:Function_Reference