0

我正在做一个用于更新通行证的网络服务器。我通过打开或关闭自动更新的切换来测试更新。这是我从控制台得到的:
Apr 8 13:19:47 CamMobs-iPod4 passd[21] <Warning>: Get pass task (pass type pass.cam-mob.passbookpasstest, serial number 0001, if-modified-since (null); with web service url http://192.168.1.202:8888/passesWebserver/) encountered error: Server response was malformed (Missing response data) 这是我使用的代码:

if (strtoupper($_SERVER['REQUEST_METHOD']) === "GET" && $request[3]==='passes'){

$passTypeID = $request[4];

$serial = $request[5];

 $auth_key = str_replace('ApplePass ', '', $headers['Authorization']);

$querySelect = mysql_query("select * from registration");
$row = mysql_fetch_array($querySelect);
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])){
    if ($passTypeID == $row['passTypeID'] && $serial ==$row['serialNo']){
        $pkpass_file = '/Applications/MAMP/htdocs/passesWebserver/DigiClubCard.pkpass';

        header("Pragma: no-cache");
        header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
        header("Content-type: application/vnd.apple.pkpass; charset=UTF-8");
        header('Content-Disposition:attachment; filename="genericPass.pkpass"');
        clearstatcache();
        $filesize = filesize($pkpass_file);
        if ($filesize)
            header("Content-Length: ". $filesize);
            header('Content-Transfer-Encoding: binary');
        if (filemtime($pkpass_file)) {
            date_default_timezone_set("UTC");
            header('Last-Modified: ' . date("D, d M Y H:i:s", filemtime($pkpass_file)) . ' GMT');
        }
        flush();
        readfile($pkpass_file);
    } } }`
4

1 回答 1

0

您正在从注册表中选择所有 (*) 到 中$row,但是$row当它实际上是 MySQL 结果时,就好像它是 MySQL 行一样处理。

因此,您的 if 语句没有触发,因此您的代码没有发回任何内容,而不是 passbook 期望的 .pkpass 包。

于 2013-04-08T08:15:46.973 回答