函數
~~~
function getTimeWeek($time, $i = 0) {
$weekarray = array("一", "二", "三", "四", "五", "六", "日");
$oneD = 24 * 60 * 60;
return "周" . $weekarray[date("w", $time + $oneD * $i)];
}
~~~
使用
~~~
$time=time();
echo getTimeWeek($tiem);
~~~
前端顯示
~~~
今天:
{$time|getTimeWeek}//星期
{$time|date="m月d日",###}//幾月幾日
明天:
{php}echo (getTimeWeek($time,1));{/php}
{$time+ 24 * 3600 - 1|date="m月d日",###}
后天:
{php}echo (getTimeWeek($time,2));{/php}
{$time+(24 * 3600 - 1)*2|date="m月d日",###}
~~~
~~~
if(!function_exists('getTimeWeek')){//此行作用套個‘馬甲’,當沒有函數時執行,有效減少錯誤
function getTimeWeek($time, $i = 0) {
$weekarray = array("日", "一", "二", "三", "四", "五", "六");
$oneD = 24 * 60 * 60;
return "周" . $weekarray[date("w", $time + $oneD * $i)];
}
}
~~~
- 心靈筆記
- tp5在編輯器一行一個添加信息
- 出庫入庫處理
- 出庫
- 入庫
- 后臺控制器
- tp5加載更多-流加載
- 配件列表
- Parts.php
- add.html
- edit.html
- 圖片管理
- controller
- 1.imgfile.php
- 2.imgfiletag.php
- view
- imgfile
- 1.index.html
- 2.show.html
- 3.simple.html
- 4.more.html
- 5.edit.html
- 6.deittag.html
- imgfiletag
- add.htm
- edit.htm
- model
- imgfile.php
- imgfiletag.php
- api
- upload.php
- js
- admin.js
- tp5整合百度編輯器多圖上傳
- 1.html代碼
- 2.js代碼
- 3.api代碼
- 4.extend中的拓展代碼
- tp5刪除圖片同時刪除服務器圖片
- 實用字段的的添加更新
- 根據時間戳獲取未來幾天星期幾
- curl
- 城市按字母排版
- 聚合查詢及渲染,處理產品首頁
- 過濾字段
- 風控
- 查詢id是否在數組里
- 判斷更新還是新增操作
- tp5使用引入php文件