php astrology,Astrology PHP 框架

1、Web 服务器配置

PHP 支持

URL Rewrite、PATH_INFO

2、环境需求

PHP 7.2+

扩展:gettext

3、目录结构

+ src

| - autoload.php

| + Astrology

| - Start.php

| - Kernel.php

| - Controller.php

| - Database.php

| - View.php

| + Anfora

| - Autoload.php

| + Autoload

| - ClassLoader.php

| + DbTable

| + Extension

+ app

| - bootstrap.php

| - config.php

| + Index

| + _App

| + Controller

| - _Controller.php

| - Index.php

| + Model

| + View

| + _Controller

| - _NotFound.php

| - index.mobi..php

| - index.php

| + _helper

| - footer.php

| + _layout

| - default.mobi..php

| - default.php

| + Index

+ web

| - .htaccess

| - index.php

4、入口文件

web/index.php

require_once __DIR__ . '/../app/bootstrap.php';new \Astrology\Start();

5、引导文件

app/bootstrap.php

define('APP_ROOT', realpath(__DIR__));define('ANFORA_AUTOLOAD', 0);if(ANFORA_AUTOLOAD) {require APP_ROOT . '/../src/autoload.php';

}else{require APP_ROOT . '/../vendor/autoload.php';

}include_once 'function.php';

6、自动加载类

src/autoload.php

require_once __DIR__ . '/Anfora/Autoload.php';return Anfora_Autoload::getLoader();

7、运行

src/Astrology/Start.php

class Start extendsKernel

{public function__construct()

{$this->loadConfig();$this->initRoute();$this->loadController();

}public functionloadConfig()

{$GLOBALS['CONFIG'] = include_once APP_ROOT . '/config.php';/*这里获取配置中的默认语言、客户端语言...*/

/*使用 gettext 扩展、没有的话用 PHP 数组代替*/@$GLOBALS['LANG'] = include_once $directory . "/$locale/LC_MESSAGES/$text_domain.php";

}

}

8、主内核

classKernel

{public function__construct()

{/*REQUEST_URI 修正*/

/*开启缓存、php_errormsg 和 php.ini 信息、客户端设备检测*/}public functioninitRoute()

{/*默认路由设置*/

/*从 REQUEST_URI、PATH_INFO、QUERY_STRING(m, c, a 或 r)获取路由信息*/

/*匹配路由规则*/

/*模块和控制器异常处理*/}public functionloadController()

{/*添加 Composer 加载规则*/

/*检测模块和控制器、引入控制器*/}

}

9、控制器原型

classController

{public function__construct()

{/*设置动作方法*/

/*是否开启 session*/}public function run($method = null)

{/*执行方法*/}public function_NotFound()

{/*全局未找到动作*/}public function _redirect($url = '/', $second = null, $prefix = null)

{/*几种重定向*/}public function__destruct()

{/*是否自动运行*/

/*是否渲染页面*/

/*输出格式*/}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值