PHP writes a server that implements interaction with Android, how to resolve

Source: Internet
Author: User
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
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.