进一步演示了Wml的表单提交,用惯了html觉得wml这家伙不是很靠谱。也许是不习惯吧…网上的资料不多,尤其是深入的、描述细节的太少了。现在存在的一个bug就是提交表单后,不能清空input,郁闷!~
超帅偏爱文本数据库,应该看中了文本库的”单文件”特点,备份和恢复起来那是相当的方便。但实现起来比较麻烦,要在早期搭建模型的时候考虑效率和日后扩展的诸多因素。个人觉得不适合用在数据量较大的应用中…
这个例子简单写了2个函数读写数据文件,日后打算单独拿出来写个class
演示地址 www.guosheng.org/wap/beta2.php
<?php
function read(){
$fp=fopen('beta0.2.txt','r');
$arr=file('beta0.2.txt');
foreach($arr as $x){
echo '<p>'.$x.'</p>';
}
}function write($txt){
$fp=fopen('beta0.2.txt','a');
fwrite($fp,$txt."\n");
fclose($fp);
}
?>
<wml>
<?php write($_POST['key']);?>
<card title="我呸Wap Beta0.1">
<p><a href="http://www.guosheng.org/">返回首页</a></p>
<?php read();?>
<p>
<input name="keyword" title="keyword" type="text" format="*M" emptyok="false" maxlength="12"/>
<anchor title="提交">提交
<go href="index.php" method="post">
<postfield name="key" value="$(keyword:unesc)"/>
</go>
</anchor>
</p>
</card>
</wml>