teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

例を書き直しました。

2019/07/17 07:14

投稿

helloman
helloman

スコア39

title CHANGED
File without changes
body CHANGED
@@ -1,28 +1,41 @@
1
1
  ```php
2
- function page() {全体を処理}
3
- function content() {コンテンツを処理}
4
- function header() {ヘッダーを処理}
5
- function footer() {フッターを処理}
6
2
 
3
+ function page($page) {
4
+ return str_replace('あ', 'ああ', $page);
5
+ }
6
+ function content($content) {
7
+ return str_replace('い', 'いい', $content);
8
+ }
9
+ function header($header) {
10
+ return str_replace('う', 'うう', $header);
11
+ }
12
+ function footer($footer) {
13
+ return str_replace('え', 'ええ', $footer);
14
+ }
15
+
7
16
  // コンテンツの最初
8
17
  ob_start('page');
9
18
 
10
- ob_start('content');
11
-
12
19
  ob_start('header');
13
20
  ヘッダーの内容
21
+ ヘッダーの内容
22
+ ヘッダーの内容
14
23
  ob_end_flush(); // headerの終わり
15
24
 
16
25
  ob_start('content');
17
26
  コンテンツの内容
27
+ コンテンツの内容
28
+ コンテンツの内容
18
29
  ob_end_flush(); // contentの終わり
19
30
 
20
31
  ob_start('footer');
21
32
  フッターの内容
33
+ フッターの内容
34
+ フッターの内容
22
35
  ob_end_flush(); // footerの終わり
23
36
 
24
37
  ob_end_flush(); // pageの終わり
25
- // コンテンツの最後
38
+
26
39
  ```
27
40
 
28
41
  みたいなことをしたいのですが、

1

説明を追加しました

2019/07/17 07:14

投稿

helloman
helloman

スコア39

title CHANGED
File without changes
body CHANGED
@@ -1,27 +1,27 @@
1
1
  ```php
2
- functiom a() {...}
2
+ function page() {全体を処理}
3
- functiom b() {...}
4
- functiom c() {...}
3
+ function content() {コンテンツを処理}
5
- functiom d() {...}
4
+ function header() {ヘッダーを処理}
5
+ function footer() {フッターを処理}
6
6
 
7
7
  // コンテンツの最初
8
+ ob_start('page');
8
9
 
9
- ob_start('a');
10
+ ob_start('content');
10
11
 
11
- ob_start('b');
12
+ ob_start('header');
13
+ ヘッダーの内容
14
+ ob_end_flush(); // headerの終わり
12
15
 
13
- ob_start('c');
16
+ ob_start('content');
14
- 〜色々な内容
17
+ コンテンツの内容
15
- ob_end_flush(); // cの終わり
18
+ ob_end_flush(); // contentの終わり
16
19
 
17
- ob_start('d');
20
+ ob_start('footer');
18
- 〜色々な内容
21
+ フッターの内容
19
- ob_end_flush(); // dの終わり
22
+ ob_end_flush(); // footerの終わり
20
23
 
21
- ob_end_flush(); // bの終わり
22
-
23
- ob_end_flush(); // aの終わり
24
+ ob_end_flush(); // pageの終わり
24
-
25
25
  // コンテンツの最後
26
26
  ```
27
27