PHP模块库实现之路由(router)

PHP模块库实现之路由(router)

<?php

namespace RouteModule;
include_once __DIR__ . "/../Receive/Receive.php";
include_once __DIR__ . "/../Response/Response.php";
include_once __DIR__ . "/../Log/Log.php";

/**
 * Class RouteModel
 * @package RouteModule
 */
class RouteModel
{
   
    public $path;// 路径
    public $path_match;// 参数匹配路径
    public $global_args;// 路由全局变量
    public $args = array();// 变量
    public $log = false;// 日志
    public $log_path = __DIR__ . "\\logs";// 日志路径
    public $desc;// 描述
    public $receive_data;// 接收到的数据
    public $receive_params = array();// 接收到的必须参数
    public $receive_method = "GET";// 接受方式
    public $request_data;// 请求到的数据
    public $request_method = "GET";// 请求方式
    public $hooks = array();// 钩子函数
    public $response;// 响应数据
    public $params = array();
}

/**
 * Class RouteModule
 * @package RouteModule
 */
class RouteModule extends RouteModel
{
   
    public function __construct($options = array())
    {
   
        $this->path = isset($options["path"]) ? $options["path"] : $this->path;
        $this->args = isset($options["args"]) ? $options["args"] : $this->args;
        $this->global_args = isset($options["global_args"]) ? $options["global_args"] : $this->global_args;
        $this->log = isset($options["log"]) ? $options["log"] : $this->log;
        $this->log_path = isset($options["log_path"]) ? $options["log_path"] : $this->log_path;
        $this->desc = isset($options["desc"]) ? $options["desc"] : $this->desc;
        $this->receive_method = isset($options["receive_method"]) ? $options["receive_method"] : $this->receive_method;
        $this->receive_params = isset($options["receive_params"]) ? $options["receive_params"] : $this->receive_params
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值