首先确认 PHP7 扩展 Asf 已经安装完成
+ public
| - index.php //入口文件
+ config
| - config.ini //配置文件
+ library //本地类库
+ application
| - Bootstrap.php
| - Constants.php
+ api // 模块名称
|+ services
|- Index.php //默认控制器
|+ logics //logic目录
|+ daos //DB操作目录
支持三种配置文件模式 ini文件 、 php文件 、 PHP变量array
<?php
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
)
);
<?php
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
)
);
$handle = new Asf_Application($configs);
$handle->run();
<?php
use Asf\Application;
$configs = array(
'asf' => array(
'root_path' => realpath(dirname(__FILE__)),
)
);
$handle = new Application($configs);
$handle->run();
http://www.domain.cn/index.php
// asf.ctype_id = 5 (default)
{
"errno": 0,
"data": ""
}
// asf.ctype_id = 1
{
"errno": 0,
"errmsg": "",
"data": ""
}
Asf 框架提供了一个小工具, 能快速生成一个空项目目录
asf_project 没有任何配置要求, 执行程序在当前目录下生成指定名称的空项目结构
asf_project 如果未填写项目名称, 默认 example
[asf@test:/] ./asf_project 项目名称