面向对象的PHP

I'v just started to learn object orientated php and I'm running into what I suspect is a very trivial issue. I have two .php files, post.php and testPost.php like so:

//post.php
<?php
     class fileWrite{
     public function postMessage($logId, $text, $username){
        //If the original login form was not used then this would not be set
        date_default_timezone_set('Europe/London');

        $fp = fopen($logId, 'a');

        fwrite($fp, $text);
        fclose($fp);
     }
}
?>

//testPost.php
<?php
    include 'post.php';
    $post = new fileWrite;
    $post->postMessage("log.html", "test", "username");
?>

When I run testPost.php this is the output: postMessage("log.html", "test", "username"); ?>

Any help would be greatly appreciated.

Just tested your code and it works nicely, check for a typo or that your script has the extension .php. If not this will cause the output to show literally your code.