Example #1
0
        echo fread($handle, filesize(DATA_FILE));
        fclose($handle);
    }
    private function appendToFile($content)
    {
        $handle = $this->openFile('a');
        if (!fwrite($handle, $content)) {
            exit('write file failed');
        }
        fclose($handle);
        return true;
    }
}
$obj = new Controller();
$method = isset($_GET['m']) ? trim($_GET['m']) : '';
switch ($method) {
    case 'getList':
        $obj->getList();
        break;
    case '':
        $obj->index();
        break;
    case 'create':
        $obj->create();
        break;
    case 'getLineNum':
        $obj->getLineNum();
    case 'compareCode':
        $obj->compareCode();
}
exit;