Example Number 2.xx

Example Name: HelloUser.php

Language: PHP

Version: 1.0.2

Code:

<?php
/* File: {service path}/com/oreilly/frdg/HelloWorld.php
   provides the HelloWorld class used in Chapter 1*/
class HelloUser { 
  function HelloUser() { /* constructor */
    $this->methodTable = array(
      'sayHello' => array(
      'description' => 'Says a friendly hello to the user',
      'access' => 'remote',
      'arguments' => array('username')
      )
    );
  }
  function sayHello($username) {
    return "Hello $username. It is " . date('H:M:s',time());
  }
}


?>

Download code text

Download chapter example files