To open the WINRAR help file, we mentioned in the Help file that the two parameters for modifying the rarfile comment in command line mode and adding the compressed file are A \ C, respectively. The description file of WINRAR is as follows:
Add all *. hlp files from the current folder to the compressed file help.rar.
WinRAR a help *. hlp
You can use the-z <File> switch to add comments from a file.
WinRAR c -zinfo.txt dummy
In this way, we can use PHP to call CMD and run the above two WINRAR parameters to modify the annotations of rarfile in batches and add the files of the compressed package. note that CMD cannot be called directly when PHP is enabled in safe mode.
Both dig and CMD. EXE are in the same directory as 1.php.Copy codeThe Code is as follows: <?
$ 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. "<br> ";
If (! File_exists ($ filename ))
{
Echo "the file does not exist, go to the next ID ";
$ Id ++;
Echo "<META HTTP-EQUIV = 'refresh'
CONTENT = '0; URL = ../test/1.php? Id = $ id'> ";
Exit;
} // Read the file name and check whether the file exists
Else
{
'Winrar a $ filename use description .txt ';
Echo "the file is successfully inserted ";
$ Id ++;
Echo "<META HTTP-EQUIV = 'refresh' CONTENT = '0; URL = ../test/1.php? Id = $ id'> ";
}
Odbc_close ($ db );
?>
*
Collection has become popular recently. Many friends may try to build a site with rich content by collecting data.
However, in some cases, the rarfiles we normally collect are added with comments in batches. In this case, if we put the data on our own website, it would be tantamount to advertising for others.
Recently, I also encountered such a problem, which was a big headache. Later, I carefully looked at the WINRAR help file and found that we can use the following methods to make batch modifications.
To open the WINRAR help file, we mentioned in the Help file that the two parameters for modifying the rarfile comment in command line mode and adding the compressed file are A \ C, respectively. The description file of WINRAR is as follows:
Add all *. hlp files from the current folder to the compressed file help.rar.
WinRAR a help *. hlp
You can use the-z <File> switch to add comments from a file.
WinRAR c -zinfo.txt dummy
In this way, we can use PHP to call CMD and run the above two WINRAR parameters to modify the annotations of rarfile in batches and add the files of the compressed package. note that CMD cannot be called directly when PHP is enabled in safe mode.
The following code reads the file path from my database and finally implements the method of modifying rarfile comments in batches. because the database is ACCESS, I have created an ODBC source. RAR. EXE and CMD. EXE is in 1. under the same directory of PHPCopy codeThe Code is as follows:
<?
$ 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. "<br> ";
If (! File_exists ($ filename ))
{
Echo "the file does not exist, go to the next ID ";
$ Id ++;
Echo "<META HTTP-EQUIV = 'refresh'
CONTENT = '0; URL = ../test/1.php? Id = $ id'> ";
Exit;
} // Read the file name and check whether the file exists
Else
{
'Winrar a $ filename use description .txt ';
Echo "the file is successfully inserted ";
$ Id ++;
Echo "<META HTTP-EQUIV = 'refresh' CONTENT = '0; URL = ../test/1.php? Id = $ id'> ";
}
Odbc_close ($ db );
?>