Home > Backend Development > PHP Tutorial > Return code and signature verification of PHP interface

Return code and signature verification of PHP interface

WBOY
Release: 2016-09-15 11:30:55
Original
1150 people have browsed it

1. Return code, I usually use 0 and 1, success is 0, failure is 1, this is how everyone usually writes it.
2. Also, for the sake of interface security, how do everyone sign?

Reply content:

1. Return code, I usually use 0 and 1, success is 0, failure is 1, this is how everyone usually writes it.
2. Also, for the sake of interface security, how do everyone sign?

Restful and Oauth available

The return code can be segmented according to the business definition, instead of simply 0, 1. This will be clearer

  1. Return code: It is recommended to discuss this with the web front-end/App developer. It is easy to say that the request is successful, but there are many reasons for the error. Breaking it down is more beneficial to debugging. Otherwise, if you return a 0, the client will not know it. Is there an error in my own request or is there an error in the server?

  2. Interface security: Try HTTPS encrypted traffic and authenticate the request at the same time. Our backend sends a Token to the client after verifying the user's identity. It uses the Token to verify the user's identity and at the same time authenticates the native client request Header information. Some modifications have been made, and those that do not comply will be filtered out.

Look this may help you:
http://developer.qiniu.com/ar...

1. Signature verification I currently use a combination of oAuth2.0 and HTTP authentication mechanism. You can refer to JWT authentication
2. Return code. This usually needs to be discussed with your interface requester or unilaterally. Determine a standard for them. I am currently using HTTP status code as the return code. Every programmer understands HTTP status code, which saves planning time and time to connect with this aspect.

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template