php语言,如何用html代码输出一个网页ob_start&&ob_end_flush
2016-02-26 15:29
726 查看
php语言,如何用html代码输出一个网页
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>success</title>
<style type="text/css">
body { background:url(images/failure.jpg) no-repeat fixed 50% 5%; }
</style>
</head>
<body>
</body>
</html>
上面的代码就可以把想要的网页完美的输出来,而不用调用一个这样代码的网页,比如用alert弹出信息时,因为alert命令使整个进程都中断,所以网页的背景不能调用现在的网页,所以用上面的代码输出以后,就可以得到想要的效果。
<?php function callback($buffer) { // replace all the apples with oranges return (str_replace("apples", "oranges", $buffer)); } ob_start("callback");//<span class="refname">ob_start</span> — <span class="dc-title">打开输出控制缓冲</span> ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>success</title>
<style type="text/css">
body { background:url(images/failure.jpg) no-repeat fixed 50% 5%; }
</style>
</head>
<body>
</body>
</html>
<?php ob_end_flush();//<span class="refname">ob_end_flush</span> — <span class="dc-title">冲刷出(送出)输出缓冲区内容并关闭缓冲</span> ?>
上面的代码就可以把想要的网页完美的输出来,而不用调用一个这样代码的网页,比如用alert弹出信息时,因为alert命令使整个进程都中断,所以网页的背景不能调用现在的网页,所以用上面的代码输出以后,就可以得到想要的效果。
相关文章推荐
- HTML Button.onclick 事件汇总
- 纯HTML页面为了避免频繁前后台Ajax交互方案
- HTML下拉框多选
- HTML day01基础总结
- Intellij IDEA 插件的安装(live edit为例,实现HTML自动换行缩进/保存/刷新等功能)
- Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement'
- C#学习之HTML
- html meta中的viewport指令
- HTML select option基础理解及使用
- html下拉框select及其选项option的初探
- 深夜学网页(2)——html(2)
- 自写插件配置html结构的方法
- HTML介绍
- 网页div转换成图片导出——html2canvas
- 制作帮助文档的好助手- WORD2CHM WORD2HTML
- day01—HTML网页编程基础
- html 中怎么设置div的位置
- 正值表达式匹配html标签的属性值
- 关于 html 中 table 表格 tr,td 的高度和宽度
- HTML列表框元素的操作