这是我的代码,我有用于生成新文件的计数器值。我通过ajax将单位值传递给php。每当我改变单位值时,我想重置计数器值。怎么做?如何重置计数器值?
$v=$_GET['v'];
$project=$_GET['p'];
$unit=$_GET['u'];
echo $unit ;
$a_str = array($_POST["content"]);
$a_url = $_POST["url"];
$contents = implode(PHP_EOL, $a_str);
$filename = file_get_contents($project."/counter.txt");
$counter = file_exists($project.'/counter.txt') ? file_get_contents($project."/counter.txt")+1 : 1 ;
$contents .= PHP_EOL . PHP_EOL;
file_put_contents($project."/unit-".$unit.'.'.$counter."-".$v.".html",$contents);
file_put_contents($project."/counter.txt",$counter);
你在哪里更改单位价值? –
我通过UI更改了单位值 – user2653831
代码中的变化在哪里? –