«

2.1.3 首页不显示解决方法

小辰 • 2023-05-04 00:19 • 678 次点击 •


更新首页不显示解决方法

找到模板内的log_list.php文件
找到这个代码

if($pageurl == Url::logPage()){include View::getView('index');exit;}

改为

if(empty($sortid) && empty($tag) && empty($keyword) && empty($author) && $page == 1){include View::getView('index');exit;}

或者

if(BLOG_URL.trim(Dispatcher::setPath(), '/') == BLOG_URL){ include View::getView('index');exit;}

或者更简单的

if(empty(trim(Dispatcher::setPath(),'/'))){include View::getView('index');exit;}

临时解决方法相信下个版本Emlog作者会修复的
模板首页就显示了

评论:
avatar
蕊蕊博客 用户2023-05-03 23:35
if(BLOG_URL.trim(Dispatcher::setPath(), '/') == BLOG_URL){
    include View::getView('index');
    exit;
}
这个也不错
commentator
小辰 楼主2023-05-03 23:42
@蕊蕊博客:这个也可以 [S22]
avatar
小风SAMA 用户2023-05-03 18:42
/**
* 判断:是否是首页
* @return boolean
*/
function isIndex(){
    if(BLOG_URL.trim(Dispatcher::setPath(), '/') == BLOG_URL){
        return true;
    }
    return false;
}
这样更简单一点,默认模板带的函数。
commentator
小风SAMA 用户2023-05-03 18:44
@小风SAMA:if(isIndex()){
    include View::getView('index');
    exit;
}
这样判断即可
commentator
小辰 楼主2023-05-03 18:47
@小风SAMA:方法很多 用得上就行[S22]