FleaPHP的安全设置方法
前提条件:
虚拟机,无法将fleaphp文件夹放在http无法访问的路径,无法修改apache和php的配置文件。
fleaphp使用默认配置
方法:
1。controller文件夹 放在根目录外 (此种办法只能适合自己有服务器)
2。在controller的文件里,尽量不要显式输出如echo print等
3。隐藏controller目录 如取个类似密码的文件夹sdfsdf12312SDCVd/Flea
4,通过配置文件更改默认CMT的目录名称
5.在根目录下面放一个.htaccess用于禁止某些目录的访问权限(只适合apache服务器)
6 在无法修改任何配置文件的情况下除了index.php外,所有的MVC层文件都在最前加上
defined('APP_DIR') or header("HTTP/1.0 404 Not Found");并且'APP_DIR'最好改成不易猜到的名字
7.在目录内 放置一个空的 index.htm 文件,也是防止目录泄露的办法之一。
8、
function FLEA_Exception($message = null, $code = 0)
{
$this->message = $message;
$this->code = $code;
$this->trac = debug_backtrace();
// 取得抛出异常的文件和代码行号
$last = array_shift($this->trac);
$this->file = $last['file'];
$this->line = $last['line'];
}
这是FLEA处理异常class FLEA_Exception的构造函数.我的个人想法,可以在程序挂上去的时候改
// 取得抛出异常的文件和代码行号
$last = array_shift($this->trac);
$this->file = $last['file'];
$this->line = $last['line'];
这部分

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version
Visual web development tools

Atom editor mac version download
The most popular open source editor
