Bootstrapping

Let's create a bootstrap file and include it at the top of every page script.

We'll cover the following

Creating a bootstrap file

Before you can use _flash_message.php, the session data should be loaded into $_SESSION. This means that the session needs to be started on every page as well. We can’t do this in _header.php itself because some pages have to use the session before they include _header.php. We should consider starting the session as part of the startup phase of every page, something that has to be done before we do any other work. In most other contexts, this is called a “bootstrap” phase, so let’s introduce a file with the same name (bootstrap.php) that can be included at the top of every page script:

Get hands-on with 1200+ tech skills courses.