让Drupal在登录后自动跳转到登录之前的页面

在模版页内用l()加入如下登录链接:

l("登录", "user/login", array('attributes' => array('title' => t('登录唯枫志')), 'query' => drupal_get_destination()))
关键在于参数drupal_get_destination函数,drupal会自动获取访问页面所需的URI,并以destination=URI的形式输出,然后在登录后根据destination的值再跳转到该页面。
另外l()函数的用法参考这里,drupal_get_destination函数的说明在这里
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章