【发布时间】:2021-04-03 13:45:51
【问题描述】:
我有一个具有以下结构的项目:
.credentials
helpers.php
home.php
admin\
login.php
register.php
在helpers.php 中,我试图通过执行file_get_contents('.credentials') 来获取.credentials 的内容,但这只有在我将该文件包含在同一目录中的文件中时才有效(例如home.php ),但是当我尝试做类似的事情时:
include('../helpers.php');
在admin/login.php 文件中,它不再起作用,因为helpers.php 试图找到admin/.credentials
如何避免这种行为
【问题讨论】: