當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BaseView::display方法代碼示例

本文整理匯總了PHP中BaseView::display方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseView::display方法的具體用法?PHP BaseView::display怎麽用?PHP BaseView::display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BaseView的用法示例。


在下文中一共展示了BaseView::display方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: message


//.........這裏部分代碼省略.........
                }
                $json = json_encode($outArr);
                $callback = isset($_GET['callback']) ? $_GET['callback'] : '';
                if (preg_match("/^[a-zA-Z][a-zA-Z0-9_\\.]+\$/", $callback)) {
                    if (isset($_SERVER['REQUEST_METHOD']) && strtoupper($_SERVER['REQUEST_METHOD']) === 'POST') {
                        //POST
                        header("Content-Type: text/html");
                        $refer = isset($_SERVER['HTTP_REFERER']) ? parse_url($_SERVER['HTTP_REFERER']) : array();
                        if (!empty($refer) && substr($refer['host'], -9, 9) == 'weibo.com') {
                            $result = '<script>document.domain="weibo.com";';
                        } else {
                            $result = '<script>document.domain="sina.com.cn";';
                        }
                        $result .= "parent.{$callback}({$json});</script>";
                        echo $result;
                    } else {
                        if (isset($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
                            header('Content-Type: text/javascript; charset=UTF-8');
                        } else {
                            header('Content-Type: application/javascript; charset=UTF-8');
                        }
                        echo "{$callback}({$json});";
                    }
                } elseif ($callback) {
                    header('Content-Type: text/html; charset=UTF-8');
                    echo 'callback參數包含非法字符!';
                } else {
                    if (isset($_SERVER['HTTP_USER_AGENT']) && stripos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
                        header('Content-Type: text/plain; charset=UTF-8');
                    } else {
                        header('Content-Type: application/json; charset=UTF-8');
                    }
                    echo $json;
                }
                break;
            default:
                if (defined('QUEUE') || defined('EXTERN')) {
                    BaseModelDebug::queueOut($code, $msg, $oe);
                    return;
                }
                try {
                    $tpl = new BaseView();
                    $tpl->assign('msg', $msg);
                    $tpl->assign('url', $url);
                    $tpl->assign('t', $t);
                    if ($code == '0') {
                        $tpl->display('message/message.html');
                    } else {
                        $tpl->display('message/error.html');
                    }
                } catch (Exception $e) {
                    // 默認模板
                    $html = <<<OUT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>提示信息</title>
<meta name="keywords" content="提示信息" />
<style type="text/css">
<!--
/* 初始化CSS */
html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend,img{margin:0;padding:0;}
fieldset,img{border:none;}
address,caption,cite,code,dfn,th,var{font-style:normal;font-weight:normal;}
ul,ol{list-style:none;}
select,input{vertical-align:middle;}
select,input,textarea{font-size:12px;margin:0;}
table{border-collapse:collapse;}
body{background:#fff;color:#333;padding:5px 0;font:12px/20px "SimSun","宋體","Arial Narrow";}

.clearfix:after{content:".";display:block;height:0;visibility:hidden;clear:both;}
.clearfix{zoom:1;}
.clearit{clear:both;height:0;font-size:0;overflow:hidden;}

a{color:#009;text-decoration:none;}
a:visited{color:#800080;}
a:hover, a:active, a:focus{color:#f00;text-decoration:underline;}
a.linkRed:link,a.linkRed:visited{color:#f00!important;}/* 紅色 */
a.linkRed:hover{color:#c00!important;}
a.linkRed01:link,a.linkRed01:visited{color:red!important}
a.linkRed01:hover{color:red!important}

.alert{margin:150px auto;width:390px;height:201px;padding:75px 30px 0;background:url(http://i1.sinaimg.cn/dy/deco/2012/0426/pic_m_01.png) no-repeat 0 0;color:#482400;font-size:14px;line-height:38px;text-align:center;}
.error{margin:150px auto;width:390px;height:201px;padding:75px 30px 0;background:url(http://i1.sinaimg.cn/dy/deco/2012/0426/pic_m_02.png) no-repeat 0 0;color:#482400;font-size:14px;line-height:38px;text-align:center;}
-->
</style>
</head>
<body>
OUT;
                    $html .= "<div class=\"" . ($code == '0' ? 'alert' : 'error') . "\">";
                    $html .= $msg;
                    $html .= empty($url) ? '' : "<div>{$t}秒鍾後跳轉下一頁麵</div><div><a href=\"{$url}\">點擊直接跳轉</a></div>";
                    $html .= "</div></body></html>";
                    print $html;
                }
                break;
        }
        exit;
    }
開發者ID:az0ne,項目名稱:diaoyu,代碼行數:101,代碼來源:BaseModelMessage.php


注:本文中的BaseView::display方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。