动态页面内容

时间:2013-11-30 15:03:57

标签: php

我想将realation中的网站内容更改为来自以下网址的GET变量:

www.example.com/index.php?a=products
www.example.com/index.php?a=contact

我的网站包含3个区块:

  • 导航
  • 左栏
  • 右栏

动态的块是正确的块。 使用require / include是不可能的,因为它不是我打印的第一件事,然后我可能会收到已发送错误的标题。

<?php
echo "Navigator will be printed here";
echo "Left block will be printed here";
require 'dynamic_content.php';

那我怎么能这样做呢?

1 个答案:

答案 0 :(得分:1)

重新设计项目结构(推荐)或使用Output Buffering函数:

<?php

ob_start();

echo "Navigator will be printed here";
echo "Left block will be printed here";
require 'dynamic_content.php';

ob_end_flush();
相关问题