what is difference between header and include, where which one should be used

前端 未结 8 1868
我在风中等你
我在风中等你 2021-02-07 18:58

I am confused with two terms

  1. header (\"Location:homepage_php\");

  2. include(\"homepage.php\");

I am g

相关标签:
8条回答
  • 2021-02-07 19:37

    Header forwards the user to a new page, so PHP reinitializes, it's like a HTML meta redirection, but faster.

    Include just includes the file where you call it, and it executes it as PHP, just like if the code from homepage.php was written where you write <?php include('homepage.php'); ?>.

    0 讨论(0)
  • 2021-02-07 19:40

    The first is used for redirecting users to a different page.

    Second is mostly used in templating systems to use various pages in one page. eg header.php, and footer.php will be included in content.php.

    0 讨论(0)
提交回复
热议问题