• 代码片段


    $fp = fopen($filename, "w");
    fwrite($fp, json_encode($userinfo));
    fclose($fp);

    date("H:i:s");

    SELECT * FROM t_details WHERE nickname IS NULL

    if (strlen($foo) < 5) { echo “Foo is too short”; }
    vs.(与下面的技巧做比较)
    if (!isset($foo{5})) { echo “Foo is too short”; }

    $blog = '博客园';

    echo 'Hello!',$blog,'this a IT blog';

        public function getFriendlyTime($timestamp)
        {
            $thisYear = date("Y");
            $thisMonth = date("n");
            $thisDay = date("j");
    
            $someYear = date("Y", $timestamp);
            $someMonth = date("n", $timestamp);
            $someDay = date("j", $timestamp);
            if ($someYear == $thisYear) {
                if ($someMonth == $thisMonth) {
                    if ($thisDay == $someDay) {
                        return date("H:i:s", $timestamp);
                    }
    
                    return date("n月j日 H:i", $timestamp);
                }
    
                return date("n月j日 H:i", $timestamp);
            }
    
            return date("Y年n月j日 H:i", $timestamp);
        }
        public function getFixedLengthString($string, $length = 6)
        {
            if (mb_strlen($string, "UTF-8") > $length)
            {
                return mb_substr($string, 0, $length, "UTF-8")."...";
            }
    
            return $string;
        }
  • 相关阅读:
    739. Daily Temperatures
    556. Next Greater Element III
    1078. Occurrences After Bigram
    1053. Previous Permutation With One Swap
    565. Array Nesting
    1052. Grumpy Bookstore Owner
    1051. Height Checker
    数据库入门及SQL基本语法
    ISCSI的概念
    配置一个IP SAN 存储服务器
  • 原文地址:https://www.cnblogs.com/jackiehe/p/4434586.html
Copyright © 2020-2023  润新知