• YII2 modules新增路由访问


    前言

    tips:如果本文对你有用,请爱心点个赞,提高排名,让这篇文章帮助更多的人。谢谢大家!比心❤~
    如果解决不了,可以在文末加我微信,进群交流。

    此处将一个心跳检测的接口作为一个modules举例

    配置config/modules.php

    'healthy' => 'backendmoduleshealthyModule',
    

    填写modules请求文件

    1. 在目录backend/modules/healthy/创建Module.php,写入以下内容
    <?php
    
    namespace backendmoduleshealthy;
    
    /**
     * workorder module definition class
     */
    class Module extends yiiaseModule
    {
        /**
         * @inheritdoc
         */
        public $controllerNamespace = 'backendmoduleshealthycontrollers';
    
        public $defaultRoute = '';
    
        /**
         * @inheritdoc
         */
        public function init()
        {
            parent::init();
        }
    }
    
    1. 在目录backend/modules/healthy/controllers创建HeartbeatController.php文件,写入以下内容
    <?php
    namespace backendmoduleshealthycontrollers;
    use yiiwebController;
    
    class HeartbeatController extends Controller {
        public function actionCheck(){
            echo 'App heartbeat check.';exit(200);
        }
    }
    
    1. 使用postman请求

    有问题请添加个人微信:【mengyilingjian】,进群一起技术讨论。添加时请备注来意,谢谢!
    在这里插入图片描述

  • 相关阅读:
    SAP GUI中按F1后显示的帮助窗口为空白
    SAP事务代码之IMG设置
    RFC 同步异步调用实例
    SAP R/3 与其他异构系统集成时是否需要应用 SAP XI
    SAP 用户管理事务代码
    SAP 模块中文解释
    SAP Table 类型
    SAP System Tables
    开发SAP的语言
    IDOC 创建,增强,管理,配置
  • 原文地址:https://www.cnblogs.com/mengyilingjian/p/14146711.html
Copyright © 2020-2023  润新知