如何从php页面返回响应

I am trying to develop an interface between a desktop application using .asp and SQL database and a web-based mobile app using PHP and MySQL. Each app needs to interrogate and/or update each of the respective databases. The plan is to create separate pages on each side each to provide a particular function. For example if the mobile app needed to retrieve a client name from the desktop, the mobile app would hit the page with the statement

$info = get_client_info.asp?clientno=1233

$info might be a string "John|Smith|555-654-0985" which could then be exploded.

An identical page to send the data to the desktop might be

info = get_client_info.php?clientno=1233

I am, of course, familiar with the 'return' statement in a function call but from just a PHP page would I simply use an 'echo' statement instead of the return, like I would with AJAX.

Also, assuming the above is correct, would I follow the echo with exit(); if it were within a conditional block and I wanted to terminate the page code early?

You can indeed use echo to output a string to the browser.

To make it more robust and nice for future uses consider outputting in json and parsing that on the platform.

PHP has built in functions to both parse and encode json. This will make it easier for you to understand the clear text protocol in the future. Note that this is not canonical truth, but personal opinion.

If you want to stop execution of the script use http://php.net/manual/en/function.exit.php .

Good luck with your solutions.