yaf初始化项目配置
1. 下载https://github.com/laruence/yaf/archive/master.zip2. 找到yaf_cg文件cd yaf-master/tools/cg3. 创建项目./yaf_cg testAPI4. 项目会出现在yaf_cg同级目录中的output文件夹中cd output/testAPI一个最精简的Yaf项目就生成了...
·
1. 下载
https://github.com/laruence/yaf/archive/master.zip
2. 找到yaf_cg文件
cd yaf-master/tools/cg
3. 创建项目
./yaf_cg testAPI
4. 项目会出现在yaf_cg同级目录中的output文件夹中
cd output/testAPI
一个最精简的Yaf项目就生成了
5. 它的index.php是入口文件,使用conf中的配置文件调用Bootstrap,把这个项目跑起来
6. Bootstrap.php是开发过程中的入口,很多基础功能都是在这里先注册的
YAF_API
index.php --->>> 加载conf中的文件 --->>>调用Bootstrap.php --->>> 根据请求里的controller和action的定义找到对应的controller
YAF的rewrite规则,适合大部分项目
$router = Yaf_Dispatcher::getInstance()->getRouter();
$route = new Yaf_Route_Rewrite(
'product/:ident',
array(
'controller' => 'products',
'action' => 'view'
)
);
$router->addRoute('product', $route);
更多推荐
已为社区贡献1条内容
所有评论(0)