【发布时间】:2017-04-30 06:26:50
【问题描述】:
我正在诊断 WP_cron() 的问题,因此我编写了一个非常短的应用程序来列出待处理的 cron() 任务。
<? php
/*
Plugin Name: My WP-Cron Test
(there are more comments here but I left them out for brevity)
*/
function wpcron_print_tasks() {
echo '<pre>';
print_r( _get_cron_array() );
echo '</pre>';
}
?>
尝试激活这个小插件会导致以下结果:
插件无法激活,因为它触发了致命错误。 解析错误:语法错误,unexpected 'function' (T_FUNCTION) in /latamconnex/wp-content/plugins/my-wp-cron-test/my-wp-cron-test.php 上 第 12 行
第 12 行根据编译器触发此操作,即 wpcron_print_tasks()。
不知何故,即使这个插件只有一行带有 echo 命令,它也会触发错误。
关于构建一个简单的插件,我是否缺少一些基本的东西?
基本上,我想知道我需要知道什么才能激活最简单的插件。
系统详情:WordPress 4.7,PHP v. 7.0.13,通过 Pressable.com 在线部署
【问题讨论】: