preventing直接访问PHP文件 [英] Preventing direct access to php files

查看:134
本文介绍了preventing直接访问PHP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的文件结构的一个例子。

Here is an example of my file structure.

/index.php
/inc
/inc/file1.php
/inc/file2.php
/inc/file3.php
/search.php

index.php文件包括()file1.php,file2.php和file3.php。
 我想他们是通过index.php文件只能访问。

index.php includes() file1.php, file2.php, and file3.php. And I want them to be accessible by index.php only.

什么是可用的最优雅的解决方案?

What's the most elegant solution available?

感谢

推荐答案

让他们的文档根目录以外的:

Get them outside the document root:

/documentroot/index.php
/inc/file1.php
/inc/file2.php
/inc/file3.php

因此​​,有他们无法直接访问任何责任。

So, there is no direct access to them whatsoever.

这篇关于preventing直接访问PHP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆