跳转到主要内容
qinshuguo 提交于 16 August 2015

test

function he_custom_theme() {
  $theme = _is_mobile () ? 'bootstrap_example' : 'bartik';
  // Allow the user to request a particular theme via a query parameter.
  if (isset ( $_GET ['theme'] )) {
    $theme = $_GET ['theme'];
  }
  return $theme;
}

function _is_mobile() {
  if (stripos ( $_SERVER ['HTTP_USER_AGENT'], 'android' )) {
    return true;
  } elseif (stripos ( $_SERVER ['HTTP_USER_AGENT'], 'iphone' )) {
    return true;
  } elseif (stripos ( $_SERVER ['HTTP_USER_AGENT'], 'ipad' )) {
    return true;
  } else {
    return false;
  }
}

 

Drupal 版本