PHP writes a server to enable interaction with Android
Just learn php two days, Mister want me to write a server and Android interaction, the function does not need to be very powerful, output a Hello world can, no ideas ah, ask the great gods!
------Solution--------------------
Just the echo output.
echo ' Hello World ';
------Solution--------------------
Write a PHP page on the 2 floor and then visit any browser on Android to see it!
------Solution--------------------
The PHP side of the direct echo output is available, Android access to that page can be obtained.
If you want to more complex point data, json_encode after echo,android obtained and then solved it can be used, if the data utf8
------Solution--------------------
The title is so tall, the answer is so simple ...
------Solution--------------------
Frankly speaking, PHP server is to do logic and data processing, and then in a fixed format output, Android use the HTTP protocol or other protocols such as soap to obtain the corresponding data.
------Solution--------------------
PHP writes a server with a ready-made framework
See http://www.workerman.net/
Many features are supported.
The startup interface is as follows:
------Solution--------------------
Socket
------Solution--------------------
If the interaction, the server is finally exported in JSON format.
$ret = Array (' result ' = ' Hello wolrd ');
echo Json_encode ($ret);
?>
{"Result": "Hello wolrd"}
------Solution--------------------
I can refer to a framework I have developed here: http://my.oschina.net/u/256338/blog/285184
[Web Services Lightweight Development Framework]ZENPHPWS3: Documentation & Samples & design & source code
is for the PHP server and Android