zoukankan      html  css  js  c++  java
  • php 总结(11)php常用整理

     展示类:
    时间戳转换时间       echo '<td>'.date("Y-m-d", $a['addtime']).'</td>';
    判断种类 输出颜色   echo "<tr";if ($a['jiedai']) {  echo " style='background:#1E9FFF;color:white'"; } echo ">" ;
     截取字符串输出 substr($arr['content'],0,10);
    编码 header("Content-type:text/html;charset=utf-8");  

    展示图片    header('content-type:image/jpeg');

     模糊查询:select * from patient_18 WHERE  name like  '%美%'

    综合模糊:SELECT * FROM patient_18 WHERE CONCAT(`name`,qq,tel,author) LIKE "%8639%"

    多次查询     

    $where = array();
    $where[] = "a>1";
    $searchword='z航三';
    if ($searchword) {
    	$where[] = "(binary t.name like '%{$searchword}%')";
    }
    $sqlwhere = count($where) > 0 ? ("where ".implode(" and ", $where)) : "";
    echo "$sqlwhere";
    

      

    万年历

    <?php 
    // 判断年份
    $years=$_GET['y']?$_GET['y']:date('Y');
    // 判断月份
    $month=$_GET['m']?$_GET['m']:date('m');
    
    
    // 判断上个月
    $prevyear=$years;
    $prevmonth=$month-1;
    if ($prevmonth<1) {
     $prevmonth=12;
    $prevyear=$years-1;
    }
    // 判断下个月
    $nextyear=$years;
    $nextmonth=$month+1;
    if ($nextmonth>12) {
     $nextmonth=1;
    $nextyear=$years+1;
    }
    
    
    // 获取当前月1号时间戳
    $firstday=strtotime("{$years}-{$month}-1");
    // echo "$firstday";
    // 判断月份天数
    $days=date('t',$firstday);
    
    // 判断周几
    $week=date('w',$firstday);
    // $week=date('w');
    // echo "<br>";
    // echo "$week";
    

     模糊 

  • 相关阅读:
    查找 Linux 父进程的方法
    Flask 使用日志
    Jenkins Pipeline 编译后端 Java 代码
    K8S 指定 nfs 挂载
    K8S ingress nginx 设置访问白名单
    Jenkins Pipeline 编译前端 NodeJS 代码
    在 K8S 中测试环境中搭建 mongodb
    K8S argocd 安装配置
    搭建私有 helm 仓库 chartmuseum
    Helm templates 中的语法
  • 原文地址:https://www.cnblogs.com/nice2018/p/10516245.html
Copyright © 2011-2022 走看看