• beego框架panic: 'GetSecurityInf' method doesn't exist in the controller CorporateInfcontroller问题解决


    在使用beego框架时,出现类似于panic: 'GetSecurityInf' method doesn't exist in the controller CorporateInfcontroller的错误时,问题出在相应的路由设置routers里或是controllers里。

     1.错误在routers中

    正确代码如下:

    beego.Router("/getsecurityinf", &controllers.SecurityInfcontroller{}, "*:GetSecurityInf")

    若在编程时错误输入以下代码,则会报以上错误:

    beego.Router("/getsecurityinf", &controllers.CorporateInfcontroller{}, "*:GetSecurityInf")

     2.错误在controllers中

    func (this *SecurityInfcontroller)GetSecurityInf() 

    一般是这句中的结构名称与结构体不对应。

    出现此错误的原因大部分是因为复制粘贴时没有修改相应的controller.

  • 相关阅读:
    24. Swap Nodes in Pairs
    49. Group Anagrams
    280. Wiggle Sort
    274. H-Index
    K Closest Numbers In Sorted Array
    Closest Number in Sorted Array
    Last Position of Target
    Classical Binary Search
    350. Intersection of Two Arrays II
    Sort Integers II
  • 原文地址:https://www.cnblogs.com/zheng123/p/8856274.html
Copyright © 2020-2023  润新知