本文整理汇总了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;
}