windows下cakephp的設立各工程

來源:互聯網
上載者:User
windows下cakephp的設定各工程

http://book.cakephp.org/2.0/zh/installation/advanced-installation.html

?

這個url裡面說的很明白,但是下面的說明是以linux為例子進行說明的,在win裡要稍微注意以下

寫道


CakePHP 核心類庫,位於 /lib/Cake 目錄。
應用程式的代碼,位於 /app 目錄。
應用程式的 webroot,通常位於 /app/webroot 目錄。

有三個常量需要修改: ROOT 、 APP_DIR 和 CAKE_CORE_INCLUDE_PATH。

ROOT 應當設定為包含你的 app 檔案夾的目錄路徑。
APP_DIR 應當設定為 app 目錄的目錄名稱(譯註:即不包含前面的路徑)。
CAKE_CORE_INCLUDE_PATH 應當設定為 CakePHP 類庫目錄的路徑。

?

譬如?

寫道

if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}

?

意味著root的路徑是此檔案的父 父 父 檔案夾

?

實際情況下,我的index.php是

C:\USBWebserverv8.5\root\myRootCakephp/index.php

設定的就是,意味著是 父 父資料夾

?

寫道

if (!defined('ROOT')) {
define('ROOT', dirname(dirname(__FILE__)));
}

?

同時,我的app和cake放在了

C:\USBWebserverv8.5\root\cakephp\app

C:\USBWebserverv8.5\root\cakephp\lib

?

寫道

if (!defined('APP_DIR')) {
define('APP_DIR', DS . 'cakephp' . DS . 'app' );
}

define('CAKE_CORE_INCLUDE_PATH', ROOT . DS .'cakephp'. DS . 'lib');

?

app和lib在同樣的路徑下,為什麼設定的時候,一個加了root,一個沒加呢?

?

在app上加了root後,會出現

Warning: include(C:\USBWebserverv8.5\root\C:\USBWebserverv8.5\root\cakephp\app\Config\core.php) [function.include]: failed to open stream: Invalid argument inC:\USBWebserverv8.5\root\cakephp\lib\Cake\Core\Configure.php?on line?72

?

裡面有2個c盤符,沒辦法,只能去掉

?

而如果lib上沒加root的話

?

Warning: include(\cakephp\lib\Cake\bootstrap.php) [function.include]: failed to open stream: No such file or directory in?C:\USBWebserverv8.5\root\myRootCakephp\index.php?on line?97

?

會直接認成類似於linux的路徑。win自然認不出來

?

所以說,調來調去的結果,只能是上面這個樣子,當然,這也說明,root,lib,app,是可以完全分開的,完全符合cakephp的說明。linux上可能會比較容易點。

?

?

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.