zoukankan      html  css  js  c++  java
  • 代码片段

    $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;
        }
  • 相关阅读:
    【CF580D】Kefa and Dishes
    【poj3311】Hie with the Pie
    校外实习-7.7
    校外实习-7.6
    校外实习-7.5
    校外实习-7.4
    作业九-课程总结(补充)
    作业九-课程总结
    作业四——结对编程四则运算
    作业三
  • 原文地址:https://www.cnblogs.com/jackiehe/p/4434586.html
Copyright © 2011-2022 走看看