适用于iOS和Android的PHP Web服务


PHP Web Service For iOS and Android

我对编写web服务有点陌生,我只需要用PHP做一个简单的web服务。使用curl时,我没有收到任何退货。有人能提出原因吗?我正在使用MAMP作为虚拟主机。这是我的服务代码:

 <?php
 include_once("JSON.php");
 $json = new Services_JSON();
 $link = mysql_pconnect("localhost:8888", "root", "root") or die("Could not connect");
 mysql_select_db("Test_RMS") or die("Could not select database");
 $arr = array();
 $rs = mysql_query("Select * from RMS_Inventory");
 while ($obj = mysql_fetch_object($rs)) {
 $arr[] = $obj;
 }
 echo $json->encode($arr);
 ?>

以下是我为CURL命令运行的内容

 curl http://localhost:8888/Tatyana.com/service2.php

有什么东西我遗漏了吗?

如果脚本在打印前崩溃,并且error_reporting设置为0,则不会显示任何内容。您可能需要检查错误日志以了解发生了什么。