マイコード:Clickable calculatorこれを順番に行う方法は?
<form method="get">
<button name="one" value="1">1</button>
<button name="two" value="2">2</button>
</form>
<?php
$count=file_get_contents('count.txt');
$count++;
file_put_contents('count.txt',$count);
$one=$_GET['one'] ?? NULL;
$two=$_GET['two'] ?? NULL;
if($one && $count==1){
file_put_contents('one1.txt',$one);
}
if($one && $count==2){
file_put_contents('one2.txt',$one);
}
if($one && $count==3){
file_put_contents('one3.txt',$one);
}
if($one && $count==4){
file_put_contents('one4.txt',$one);
}
if($one && $count==5){
file_put_contents('one5.txt',$one);
}
if($one && $count==6){
file_put_contents('one6.txt',$one);
}
//----------------------------------------
if($two && $count==1){
file_put_contents('two1.txt',$two);
}
if($two && $count==2){
file_put_contents('two2.txt',$two);
}
if($two && $count==3){
file_put_contents('two3.txt',$two);
}
if($two && $count==4){
file_put_contents('two4.txt',$two);
}
if($two && $count==5){
file_put_contents('two5.txt',$two);
}
if($two && $count==6){
file_put_contents('two6.txt',$two);
}
echo file_get_contents('one1.txt');
echo file_get_contents('one2.txt');
echo file_get_contents('one3.txt');
echo file_get_contents('one4.txt');
echo file_get_contents('one5.txt');
echo file_get_contents('one6.txt');
echo file_get_contents('two1.txt');
echo file_get_contents('two2.txt');
echo file_get_contents('two3.txt');
echo file_get_contents('two4.txt');
echo file_get_contents('two5.txt');
echo file_get_contents('two6.txt');
?>
<form>
<input type="submit" name="reset"/>
</form>
<?php
if($_GET['reset'] ?? NULL){
file_put_contents('one1.txt',false);
file_put_contents('one2.txt',false);
file_put_contents('one3.txt',false);
file_put_contents('one4.txt',false);
file_put_contents('one5.txt',false);
file_put_contents('one6.txt',false);
file_put_contents('two1.txt',false);
file_put_contents('two2.txt',false);
file_put_contents('two3.txt',false);
file_put_contents('two4.txt',false);
file_put_contents('two5.txt',false);
file_put_contents('two6.txt',false);
file_put_contents('count.txt',false);
}
?>
はどのようにそれを行うには? 例:
- 私は1を、それを書き、それが2
- 私は
<button>1</button>
をクリック書き、それが1 - 私は
<button>2</button>
にクリック書き、それが1 - 私は
<button>1</button>
をクリックし、書き込み、<button>1</button>
をクリック
など....
は次のようになります。
私はそれは、彼らがクリックされたのと同じ順番で書いているクリックすると。
ありがとうございます。
はPHPで(またはそれが何であれ)*電卓*を構築するためのナンセンスではないですか? –
これは非常にばかげたやり方です – RiggsFolly