如何在PHP中创建Rest服务器

I'm going to create a Restful web service API using PHP. I've googled and found how to create a rest client, but I want to know how to create rest server instead.

I already have a MySQL database to retrieve the data but I don't know how to output my results in XML format.

Take a look at a framework like FRAPI that helps you build REST services with minimum effort.

Take a look at RockWall engine. The main feature of RockWall is multiple REST requests by single HTTP request.

RockWall REST engine site

You can take a look at PHP-CRUD-API, which is an extensible PHP script that I wrote that does exactly what you want: provide a REST API based on a MySQL Database.