您好,欢迎访问一九零五行业门户网

thinkphp3.2路由配置,对seo友好的链接

自己改了tp3.2的分页,可以支持类似 http://www.sucaihuo.com/js/7-0-0-0 这样的url.对于搜索引擎非常友好
路由必须要开启,路由规则和静态缓存规则如下: 'url_router_on' => true,
    'url_route_rules' => array(
        'templates/:id\d' => 'templates/detail',
        'templates/:paras' => 'templates/index',
        'js/:id\d' => 'js/detail',
        'js/:paras' => 'js/index',
        'search' => 'search/templates',
        'forget' => 'pwd/find',
        'sendtip' => 'pwd/send_tip',
        'help/template_post' => 'help/template_post',
        'help/:paras' => 'help/index',
    ),
    'html_cache_on' => true, // 开启静态缓存
    'html_cache_time' => 3600, // 全局静态缓存有效期(秒)
    'html_file_suffix' => '.html', // 设置静态缓存文件后缀
    'html_cache_rules' => array(// 定义静态缓存规则
        'templates:' => array('templates/{$_get.id}_{$_get.paras}'),
        'js:' => array('js/{$_get.id}_{$_get.paras}'),
        'search:' => array('templates/{$_get.keyword}'),
        'help:' => array('help/{$_get.paras}'),
        'login:' => array('login/index'),
        'reg:' => array('reg/index'),
        'index:' => array('index/index')
    )程序调用方法
$pagecur = $parasarr[$page_site] > 0 ? $parasarr[$page_site] : 1; //当前第几页$count = m('js')->count();    //计算总数
$page = new \think\pageparams($count, $pagenum, '', array(site => $pagecur));
$lists = m('js')->limit(($pagecur - 1) * $pagenum . ',' . $pagenum) > select();
$page->setconfig('header', '共' . $count . '个特效');
//$extract 列举几个参数
$extract = array(
    cat_id => $cat_id,
    easy_id => $easy_id,
    order_id => $order_id,
);
$param_prev = implode(-, array_values($extract)) . -; //拼接链接,除了page所有参数对应值
$url_action = __app__ . '/js/';
$page->setconfig('link', $url_action . $param_prev . 'pagenum');
$this->assign(page, $page->show());你可以到我的素材火 http://www.sucaihuo.com 去看看。对seo很好哦,一个链接,一个页面。
pageparams.class.rar ( 1.96 kb 下载:52 次 )
ad:真正免费,域名+虚机+企业邮箱=0元
其它类似信息

推荐信息