What's better of require(dirname(__FILE__).'/'.'myParent.php') than just require('myParent.php')?

后端 未结 4 1280
情书的邮戳
情书的邮戳 2020-12-08 03:27

Lots of famous PHP scripts including WordPress use dirname(__FILE__).\'/myParent.php\' instead of just \'myParent.php\' when including files in the

4条回答
  •  借酒劲吻你
    2020-12-08 04:03

    Using dirname + file name is slightly faster, because PHP will not iterate through include_path searching for the file. If speed matters, you will likely type more.

提交回复
热议问题