Home  >  Article  >  Backend Development  >  Several questions about the interaction between the server and the mobile terminal

Several questions about the interaction between the server and the mobile terminal

WBOY
WBOYOriginal
2016-08-04 09:20:39814browse

I work in PHP, and my recent work involves interacting with ios and Android, so I have a few questions.

1: After logging in on the mobile terminal, how to record the currently logged in user information? The web terminal uses session, but what is used on the mobile terminal?

2: The mobile terminal still uses get and post to upload data, but when saving files, it is said online that the $_FILE array cannot be used. It can only convert the POST information into binary and save it into a file. Is there any ready-made code that I can refer to? Down?

I have only written json interfaces before. I hope someone with back-end experience in mobile terminal development can give me some advice. Thank you!

Reply content:

I work in PHP, and my recent work involves interacting with ios and Android, so I have a few questions.

1: After logging in on the mobile terminal, how to record the currently logged in user information? The web terminal uses session, but what is used on the mobile terminal?

2: The mobile terminal still uses get and post to upload data, but when saving files, it is said online that the $_FILE array cannot be used. It can only convert the POST information into binary and save it into a file. Is there any ready-made code that I can refer to? Down?

I have only written json interfaces before. I hope someone with back-end experience in mobile terminal development will give me some advice. Thank you!

  1. You can maintain a token on the web side. When the client logs in, the token returned by the server is saved, and all subsequent requests will bring the token; until there is a token and the server does not return expiration information, it is assumed that the client has logged in.

  2. If you use some network connection framework, you don’t need to convert it into a byte stream yourself. You only need to pass in the file name and path.

The mobile interface is the same as the web. Session is also used to record login status. To save a file, use $file=$_FILES['upfile'];, I remember there is no need to convert it

Statement:
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