Closed cccqcccq closed 4 months ago
我发现了问题所在,因为这里的token返回了一个nil所以后面无法获取而报错,需要给一个空的Token I discovered the problem. Because the token here returns a nil, it cannot be obtained later and an error is reported. An empty Token needs to be given.
In Go, it's best practice to check the error, and if err != nil
you typically don't trust the other returned values.
I suggest checking the err
in the example above.
In Go, it's best practice to check the error, and
if err != nil
you typically don't trust the other returned values.在 Go 中,最佳做法是检查错误,if err != nil
通常不信任其他返回的值。I suggest checking the
err
in the example above.我建议在上面的例子中检查一下err
。
Please check my latest reply, this file is parser.go in the framework
当遇到token乱传值时使用验证token会直接报错:invalid memory address or nil pointer dereference 例如:当token传值1.1.1时不会报错会提示校验失败,当传值111时候直接报错
When a token is randomly transferred, an error will be reported when the token is used to verify the value:invalid memory address or nil pointer dereference For example: when the token value is 1.1.1, no error will be reported but a verification failure will be prompted. When the value 111 is passed, an error will be reported directly.