Home >Backend Development >PHP Tutorial >PHP adds decompression instructions to rar files and implements the code_PHP tutorial
The following code is how I read the file path through my database tutorial and finally implemented batch modification of rar file comments. Because the database is access, I created a new odbc source. At the same time, rar.exe and cmd.exe are In the same directory as the 1.php tutorial
$id=$_get[id];
if($id=="")
{
echo "Parameter error";
exit;
}
if($id>=400)
{
echo "All ends";
exit ;
}
$db=odbc_connect("dw","","");
$sql="select * from 'download' where 'id'=$id";
$ query=odbc_exec($db,$sql);
$filename=odbc_result($query,2);
if($filename=="")
{}
$filename=str_replace("#1′,"",$filename);
$filename=str_replace("#2′,"",$filename);
$filename="soft/".$ filename;
echo $filename."
";
if(!file_exists($filename))
{
echo "File does not exist, go to next id";
$id++;
echo "content='0;url=../test/1.php?id=$id'>";
exit;
}//Read the file name and check whether the file exists
else
{
'winrar a $filename usage instructions.txt';
echo "Insert instructions File successful";
$id++;
echo "";
}
odbc_close($db);
?>