展示類:
時間戳轉換時間 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";
模糊