今天要做一个bbs的API不知道七夜怎么样的,要我用HessianPHP下载了个看看代码!

确实他的机制很好,等有时间好好看看,把自己的写的代码贴出来,大家看下!

service.php

opendb();
  $s_sql = "SELECT * FROM cdb_threads WHERE fid IN($id) ORDER BY lastpost DESC LIMIT $num";
  $r_query = mysql_query( $s_sql );
  while ( FALSE !== ( $a_rec = mysql_fetch_assoc( $r_query ) ) ){
   $show[] = $a_rec;
  }
  return $show;
 }
 function opendb(){
  $dbname = "club";
  $conn = mysql_connect("localhost","club", "club_test");
  if(!$conn) die(mysql_error());
  @mysql_select_db($dbname, $conn);
  if(mysql_errno()) die(mysql_error());
    return $conn;
  }
 
}
$service = &new; HessianService();
$service->registerObject(new bbs_api);
$service->displayInfo = true;
$service->service();
?>

test.php

$var</strong>
";
}
include_once('../HessianClient.php');

Hessian::errorReporting(HESSIAN_SILENT);
 $url = 'http://192.168.0.9/test/server/test/service.php';
 $proxy = &new; HessianClient($url);
 println( $proxy->bbs("12,15","100") );
if(Hessian::error()){
 println();
 printlnbold("There were errors in the connection:");
 $error = Hessian::error();
 println( $error->message);
 var_dump($error);
}

?>