Ejemplo n.º 1
0
 /**
  * 手机浏览器提示并跳转指定URL地址
  *
  * @param string  $msg    提示的内容
  * @param string  $url    要跳转的URL地址
  * @param integer $second 显示多少秒
  */
 public static function mtip($msg, $url = '', $second = 3)
 {
     if (empty($url)) {
         $url = wcore_utils::get_http_referer();
     }
     if (strpos($_SERVER["HTTP_ACCEPT"], 'wap.wml') !== false) {
         $second = $second * 10;
         $msg = strip_tags($msg);
         header('Content-Type: text/vnd.wap.wml; charset=utf-8');
         echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.3//EN\"";
         echo "\"http://www.wapforum.org/DTD/wml13.dtd\">\n<wml><card title=\"返回\" ontimer=\"{$url}\"><p>{$msg}</p>";
         exit("<p><a href=\"{$url}\">未自动跳转点击此处</a></p><timer value=\"{$second}\"/></card></wml>");
     } else {
         echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><html><head>";
         echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
         echo "<meta http-equiv=\"refresh\" content=\"{$second}; url={$url}\"><title>系统提示</title></head><body>";
         echo "<div style='margin:5px;padding:5px;line-height:22px;border:1px solid #FFCCBF;background-color:#FFFFE6;'>";
         echo "{$msg}</div><br/>{$second}秒未跳转,请点击<a href=\"{$url}\">快速跳转</a>";
         exit("</body></html>");
     }
 }
Ejemplo n.º 2
0
 /**
  * 获取域名若未指定URL地址则获取HTTP REFERER的域名
  *
  * @param string $url 域名或URL地址
  * @return string 返回域名
  */
 public static function get_http_domain($url = '')
 {
     $url = $url ? $url : wcore_utils::get_http_referer();
     if (empty($url)) {
         return '';
     }
     $res = wcore_utils::parse_href($url);
     return $res['host'];
 }