回答編集履歴
1
具体的に
answer
CHANGED
@@ -21,4 +21,49 @@
|
|
21
21
|
```
|
22
22
|
|
23
23
|
そもそも各処理が標準出力せずに文字列をreturnするようにすれば
|
24
|
-
バッファリング自体不要です
|
24
|
+
バッファリング自体不要です
|
25
|
+
|
26
|
+
# 具体的に
|
27
|
+
```PHP
|
28
|
+
<?PHP
|
29
|
+
function get_page($page) {
|
30
|
+
return str_replace('あ', 'ああ', $page);
|
31
|
+
}
|
32
|
+
function get_content($content) {
|
33
|
+
return str_replace('い', 'いい', $content);
|
34
|
+
}
|
35
|
+
function get_header($header) {
|
36
|
+
return str_replace('う', 'うう', $header);
|
37
|
+
}
|
38
|
+
function get_footer($footer) {
|
39
|
+
return str_replace('え', 'ええ', $footer);
|
40
|
+
}
|
41
|
+
|
42
|
+
$content="";
|
43
|
+
ob_start('get_page');
|
44
|
+
print "1.あいうえお\n";
|
45
|
+
$content.=ob_get_contents();
|
46
|
+
ob_clean();
|
47
|
+
|
48
|
+
ob_start('get_header');
|
49
|
+
print "2.あいうえお\n";
|
50
|
+
$content.=ob_get_contents();
|
51
|
+
ob_clean();
|
52
|
+
|
53
|
+
ob_start('get_content');
|
54
|
+
print "3.あいうえお\n";
|
55
|
+
$content.=ob_get_contents();
|
56
|
+
ob_clean();
|
57
|
+
|
58
|
+
ob_start('get_footer');
|
59
|
+
print "4.あいうえお\n";
|
60
|
+
$content.=ob_get_contents();
|
61
|
+
ob_clean();
|
62
|
+
|
63
|
+
print $content;
|
64
|
+
```
|
65
|
+
出力
|
66
|
+
1.ああいいううええお
|
67
|
+
2.ああいいううええお
|
68
|
+
3.ああいいううええお
|
69
|
+
4.ああいいううええお
|