PHP Framework --- Symfony 讀書筆記1____PHP

來源:互聯網
上載者:User

Symfony2雖然已經Release了,但還是想從1.14.x版本開始學起。

官方首頁:http://www.symfony-project.org/

下載地址:http://www.symfony-project.org/installation/1_4


確認PHP環境,使用Apache伺服器。

首先需要通過命令列代碼組建檔案目錄結構。

步驟如下:

1. 在指定路徑下建立工程檔案夾,例如 sfproject 。

2. 在工程檔案夾( sfproject )下建立目錄 lib\vendor\

3. 下載並解壓 symfony, symfony-1.4.xx.zip.改名symfony後移至 lib\vendor\ 下

4. 使用命令列產生工程檔案

    php lib\vendor\symfony\data\bin\symfony generate:project PROJECT_NAME

主要目錄如下:

Directory Description
apps/ Hosts all project applications
cache/ The files cached by the framework
config/ The project configuration files
data/ Data files like initial fixtures
lib/ The project libraries and classes
log/ The framework log files
plugins/ The installed plugins
test/ The unit and functional test files
web/ The web root directory (see below)

5. 使用命令列產生web前端檔案

    php lib\vendor\symfony\data\bin\symfony generate:app frontend

6. 修改config\databases.yml檔案中資料庫配置資訊。

    也可使用命令列: $ php symfony configure:database "mysql:host=localhost;dbname=dbname" root mYsEcret

7. Web Server Configuration修改樣本:

# Be sure to only have this line once in your configurationNameVirtualHost 127.0.0.1:8080# This is the configuration for your projectListen 127.0.0.1:8080<VirtualHost 127.0.0.1:8080>  DocumentRoot "/home/sfproject/web"  DirectoryIndex index.php  <Directory "/home/sfproject/web">    AllowOverride All    Allow from All  </Directory>  Alias /sf /home/sfproject/lib/vendor/symfony/data/web/sf  <Directory "/home/sfproject/lib/vendor/symfony/data/web/sf">    AllowOverride All    Allow from All  </Directory></VirtualHost>


聯繫我們

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