包含外部脚本的这两种不同方式的性能是否存在差异?
不使用变量:
include $_SERVER['DOCUMENT_ROOT'].'/class/conf.php';
include $_SERVER['DOCUMENT_ROOT'].'/class/Db.php';
include $_SERVER['DOCUMENT_ROOT'].'/class/Posts.php';
Run Code Online (Sandbox Code Playgroud)
使用变量:
$path = $_SERVER['DOCUMENT_ROOT'];
include $path.'/class/conf.php';
include $path.'/class/Db.php';
include $path.'/class/Posts.php';
Run Code Online (Sandbox Code Playgroud)
为了记忆目的,我可以避免变量,但我不知道这是否是一个良好的性能练习.