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

前端 未结 8 1869
我在风中等你
我在风中等你 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:25

    1 tells PHP to send a Location header to the HTTP client, forcing a redirect to "homepage.php".

    2 tells PHP to include "homepage.php" inline to execution of the current page.


    As a note about your question, your confusion might be over the term "header". It is overloaded sometimes to refer to the top part of a page in reference to code separation. Code separation is a common practice where one puts PHP code/HTML used in multiple pages into a separate file, and then included in the top (header) of each page.

    HTH,

    -aj

提交回复
热议问题