Asf 框架提供内置工具(/path-asf-src/tools/asf_project.php), 快速生成一个空项目目录
如果未填写全路径, 默认选择当前路径
如果未填写项目名称, 默认的文件夹名称 example
[fanjiapeng@host:~] /php-bin-path/php /path-asf-src/tools/asf_project.php /to-path/project_name
.
├── config
│ └── config.php
├── library
│ └── Library.php
├── modules
│ ├── api
│ │ ├── daos
│ │ │ └── Index.php
│ │ ├── logics
│ │ │ └── Index.php
│ │ └── services
│ │ └── Index.php
│ ├── Bootstrap.php
│ └── Constants.php
└── public
└── index.php
支持三种配置文件模式 ini文件 、 php文件 、 PHP变量array
采用 PHP变量 配置, 在入口页直接配置完成
<?php
/* public/index.php */
$configs = array(
'asf' => array(
'root_path' => dirname(__DIR__) . '/modules',
)
);
$handle = new Asf_Application($configs);
$handle->run();
采用 php文件 配置, 文件后缀名称必须小写
<?php
/* public/index.php */
define('APP_PATH', dirname(__DIR__));
$app = new Asf_Application(APP_PATH . '/config/config.php');
$app->run();
/* config/config.php */
$configs = array(
'asf' => array(
'root_path' => APP_PATH . '/modules',
)
);
return $configs;
采用 ini文件 配置, 文件后缀名称必须小写
<?php
/* public/index.php */
define('APP_PATH', dirname(__DIR__));
$app = new Asf_Application(APP_PATH . '/config/config.ini');
$app->run();
/* config/config.ini */
[asf]
root_path="/path/box3.cn/"
(推荐开发方式) 请在php.ini文件中配置才生效, asf.use_namespace = On
如果未启用命名空间(默认关闭), 请跳过这步
<?php use Asf\Application; $app = new Application(mixed $data); $app->run();
http://www.your-domain.com/index.php
ini_set('asf.ctype_id', 5) (default)
{
"errno": 0,
"data": ""
}
ini_set('asf.ctype_id', 1)
{
"errno": 0,
"errmsg": "",
"data": ""
}