首页
开发手册
应用中心
工具
用户中心
Encrypted application interaction method
English
中文简体
English
上一篇
下一篇
### FoundPHP Encrypted application interaction method FoundPHP provides a very simple APP interaction method, as well as other language program interaction. Here we mainly explain the two app interaction methods. The `plugin/model/api` provided in the framework is the external interface directory, the separate application file here is the corresponding interface, and the data output of the interface adopts the `json_out(result, data)` method. #### 1.Standard API Interaction Method The standard method uses 0 to 1 to judge whether the result of the program is right or wrong, 0 is wrong, and 1 is correct. The data is output in json format with data attached. ``` //Result 0 means error json_out(0, array('msg'=>'access error') ); //Result 1 means correct json_out(1, array('msg'=>'access error') ); ``` create file:: plugin/model/api/test.php address: http://Your domain name/?m=api&a=test Code: ``` 'hello world') ); exit; ?> ``` The output json data can be obtained by accessing the result: `{"code":1,"msg":"hello world"}` #### 2. Encrypted API Interaction Method Encryption can be combined with the FoundPHP encryption method explained before, so that encrypted data can be output, and the data transmission process can't be cracked even if it is intercepted. plugin/model/api/test.php address: http://Your domain name/?m=api&a=test Code: ``` encode('hello world'); //output Data json_out(1, array('msg'=>$code) ); exit; ?> ``` Output Result: `{"code":1,"msg":"npyfz6hRp6KmnpUO00"}` Expanding the array can achieve unlimited expansion, but the app is an object, so not too many layers of the array will increase the difficulty of app development.