只能在本地主机上覆盖插件挂钩,但不能在生产服务器上覆盖

Can only do override plugin hooks on localhost but not on production server

在我的本地主机上,一切都很完美,但在生产服务器上,我无法覆盖前端默认页面,即自定义索引。

start.php

elgg_register_plugin_hook_handler('index', 'system', 'custom_index', 0);

function custom_index($hook, $type, $return, $params) {
    if ($return == true) {
        // another hook has already replaced the front page
        return $return;
    }

    if (!include_once("/pages/rev_index.php")) {
        return false;
    }

    // return true to signify that we have handled the front page
    return true;
}

我只被推荐给 http://domain-name.com/activity instead of http://domain-name.com/

您的服务器上的默认路径配置可能有问题。使用绝对路径更安全,即。 include_once(__DIR__ . "/pages/rev_index.php")