从CI中的子目录外部定位文件 [英] locate file from outside a sub-directory in CI
问题描述
我有两个codeigniter安装在我的CI项目。
I have two codeigniter installs in my CI project. But in my second codeigniter install I am having trouble calling a path from outside of the install folder.
项目布局:
application folder
download folder
image folder
install folder "This contains own index.php and application folder"
system folder
index.php "main index.php"
我有麻烦从外面调用路径是安装文件夹。我需要能够找到第一个应用程序文件夹。
The area I am having trouble call path from outside is the install folder. I need to be able to locate the first application folder.
有问题的例子。
此代码在安装应用程序文件夹中查找。
<tr>
<td><?php echo FCPATH . 'application/config/database.php'; ?></td>
<td class="align_right"><?php echo is_writable(FCPATH . 'application/config/database.php') ? '<span class="text-success">Writable</span>' : '<span class="text-danger">Unwritable</span>'; ?></td>
</tr>
</tbody>
</table>
并显示 C:\xampp\htdocs\codeigniter\install\ application / config / database.php
但需要它能够获取主目录应用程序文件夹。所以看起来像这样 C:\xampp\htdocs\codeigniter\application / config / database.php
But need it to be able to pick up the main directory applications folder. So would look like this C:\xampp\htdocs\codeigniter\application/config/database.php
我不想在安装index.php中触摸任何内容
APPPATH无效,因为安装文件夹有自己的应用程序文件夹需要获取apppath从外部安装文件夹。
APPPATH Does not work because the install folder has its own application folder Need to get the apppath from outside install folder.
推荐答案
现在工作方式
<tr> <td><?php echo dirname(FCPATH) . '/application/config/config.php'; ?></td> <td class="align_right"><?php echo is_writable(dirname(FCPATH) . '/application/config/config.php') ? '<span class="text-success">Writable</span>' : '<span class="text-danger">Unwritable</span>'; ?></td> </tr>`
这篇关于从CI中的子目录外部定位文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!