Automatically checking for a new version of my application

前端 未结 12 1221
天命终不由人
天命终不由人 2021-01-30 18:12

Trying to honor a feature request from our customers, I\'d like that my application, when Internet is available, check on our website if a new version is available.

The

12条回答
  •  难免孤独
    2021-01-30 18:28

    if you keep your files in the update directory on example.com, this PHP script should download them for you given the request previously mentioned. (your update would be yourprogram.1.2.4.exe

    $version = $_GET['version'];    
    $filename = "yourprogram" . $version . ".exe";
    $filesize = filesize($filename);
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: post-check=0, pre-check=0");
    header("Content-type: application-download");
    header('Content-Length: ' . $filesize);
    header('Content-Disposition: attachment; filename="' . basename($filename).'"');
    header("Content-Transfer-Encoding: binary");
    

    This makes your web browser think it's downloading an application.

提交回复
热议问题