UNPKG

948 BHTMLView Raw
1<!DOCTYPE html>
2<html lang="zh_CN" class="html-">
3<head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8">
6 <title>同步模板测试</title>
7</head>
8<body>
9<p>
10<%- ctx.msg %>
11</p>
12
13<p><%?
14 ctx.thinking;
15 setTimeout(function () {
16 ctx.thinking = "1 seconde later"
17
18
19 aries();
20
21 }, 1000);
22
23 %>
24
25
26
27 <%- ctx.thinking %>
28
29
30</p>
31
32<p>
33
34 <%?
35 ctx.fs.readFile("demo.html", function(err, str){
36 ctx.str = str.toString();
37 aries();
38 });
39 %>
40 <%= ctx.str %>
41</p>
42
43
44<p>
45 <%?
46 ctx.respHeader={};
47 ctx.error="";
48 var req = ctx.http.get("http://www.baidu.com", function(resp) {
49 ctx.respHeader = resp.headers;
50 aries();
51 }).on('error', function(e) {
52 ctx.error = e;
53 aries();
54 });
55 req.end();
56 %>
57 <b><%- JSON.stringify(ctx.respHeader) %></b>
58 <b><%- ctx.error %></b>
59</p>
60
61<% includeId sync_foot_2 %>
62</body>
63</html>
\No newline at end of file