【问题标题】:How to take md5 of a file in php? [duplicate]如何在php中获取文件的md5? [复制]
【发布时间】:2014-02-03 18:34:04
【问题描述】:

你能解释一下如何使用 php 获取文件的 md5

【问题讨论】:

    标签: php


    【解决方案1】:

    嘿,伙计,看起来快速搜索会找到很多关于这个的,看看这个

    PHP Session timeout

    首先,存储用户最后一次发出请求的时间

    <?php
       $_SESSION['timeout'] = time();
    ?>
    

    在随后的请求中,检查他们多久以前提出过他们的上一个请求(本例中为 10 分钟)

     <?php
        if ($_SESSION['timeout'] + 10 * 60 < time()) {
             // session timed out
        } else {
          // session ok
        }
      ?>
    

    【讨论】:

    • 感谢您的重播
    • 它有效,但我认为它不符合我的要求。我的要求是,如果用户将他的 php 页面设置为理想状态 2 分钟,那么我需要销毁会话变量。
    【解决方案2】:

    我已经回答了一个类似的问题。这是15分钟后,我想你可以自己重写:

    if(time() - $_SESSION['timestamp'] > 900) { //subtract new timestamp from the old one
        alert("15 Minutes over!");
        unset($_SESSION['username'], $_SESSION['password'], $_SESSION['timestamp']);
        $_SESSION['logged_in'] = false;
        header("Location: " . index.php); //redirect to index.php
        exit;
    } else {
        $_SESSION['timestamp'] = time(); //set new timestamp
    }
    

    【讨论】:

    • 感谢您的重播
    猜你喜欢
    • 1970-01-01
    • 2014-03-13
    • 2011-01-19
    • 1970-01-01
    • 2021-01-04
    • 1970-01-01
    • 1970-01-01
    • 2012-05-09
    • 2011-07-12
    相关资源
    最近更新 更多