FleaPHP的安全設定方法_PHP教程

來源:互聯網
上載者:User
前提條件:
虛擬機器,無法將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'];
這部分

http://www.bkjia.com/PHPjc/319559.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319559.htmlTechArticle前提條件: 虛擬機器,無法將fleaphp檔案夾放在http無法訪問的路徑,無法修改apache和php的設定檔。 fleaphp使用預設配置 方法: 1。controller文...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.