最近研究Symfony框架,這方面資料不是特別豐富。今天遇到一個問題,就是在哪兒設置默認啓動模塊,和默認啓動動作。
首先,沒有默認模塊供程序啓用,會有如下提示信息:
Symfony Project Created
Congratulations! You have successfully created your symfony project.
- Project setup successful
- This project uses the symfony libraries. If you see no image in this page, you may need to configure your web server so that it gains access to the
symfony_data/web/sf/
directory.- This is a temporary page
- This page is part of the symfony
default
module. It will disappear as soon as you define ahomepage
route in yourrouting.yml
.- What's next
- Create your data model
- Customize the layout of the generated templates
- Learn more from the online documentation
遇到問題,切忌不看提示信息。我們看到紅色加粗字體部分,是說,這個頁面是Symfony框架的默認模塊,它將在你定義好主頁面後立即消失,主頁面是在routing.yml文件中設置。
這就好了,我們去打開apps/MyApps/config/routing.yml,內容如下
homepage:
url: /
param: { module: default, action: index }default_index:
url: /:module
param: { action: index }default:
url: /:module/:action/*
從第一行,我們不難看出就是設置主頁顯示的模塊和動作。把param中的default換成我們的主頁模塊,動作index也可以換成我們自己的動作
附錄:
Symfony框架的中文教程 http://www.foolbirds.com/jobeet-propel-cn
還有電子圖書版本:
《symfony 權威指南》 中文翻譯項目 http://symfony-project.cn/cooperate/book/start