Home  >  Q&A  >  body text

tp6 constructor invalid

QQ图片20220509085239.jpgQQ图片20220509085246.jpg

Does anyone know what's going on? The return of the tp6 constructor method doesn't work. It's strange.

金**的落叶金**的落叶917 days ago1374

reply all(4)I'll reply

  • autoload

    autoload2022-05-09 09:07:35

    Your usage is a bit strange. The constructor itself is to enrich the class attributes, to be precise, the object attributes. The constructor returns an object by default. If you customize the return 555, it will report an error. This is not tp6 problem.

    reply
    0
  • 金**的落叶

    In this case, I want to verify the token in the constructor. If the token expires, I will return the msg of re-logging in or re-obtaining it. Does this mean that the verification cannot be placed in the constructor?

    金**的落叶 · 2022-05-09 09:15:06
    autoload

    Just verify it in the request

    autoload · 2022-05-09 09:20:47
    金**的落叶

    Does it mean to verify in getuserinfo?

    金**的落叶 · 2022-05-09 09:24:48
  • Cancelreply