设置项目结构;我认为有一些“bootstrap.php”文件包含并设置了一切,比如数据库连接,会话管理,库,错误处理,会更好。或者仅仅包含当前所需的文件? (这将需要在包括等的顺序之前)。包含许多文件或仅包含一个文件
选择1:
的index.php
<?php
include 'bootstrap.php';
//session... database up and ready to be used...
备选方案2:
的index.php
<?php
include 'session.php';
include 'database.php';
include 'errorhandling.php';
//now use database...