Пример #1
0
    public function __construct()
    {
        exec('cat ./json.data', $result);
        $this->content = count($result) > 0 ? $result[0] : "get data error";
    }
    public function show()
    {
        echo $this->content;
    }
}
?>

<?php 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $pm = new pm();
    $pm->show();
} else {
    ?>
<html>
    <head>
        <script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
    </head>
    <title>乐居气象监测站</title>
    <link rel="icon" href="favicon.ico">
    <style>
        div {font-size:15px; line-height:20px;}
        #time {margin-top:20px;}
    </style>
    <body>
        <h3>室内:</h3>
        <div id="pm">Reading...</div>