目前分類:Programming (475)
- Jan 20 Thu 2022 14:23
[轉] Google 試算表【下拉式選單】怎麼做?資料驗證2招用起來!
- Jan 05 Wed 2022 14:17
[PHP][轉] PHP File Create/Write - PHP建立檔案/寫入檔案
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); // 建立檔案
- Dec 22 Wed 2021 14:19
[Word] Word「第幾頁,共幾頁」選項怎麼不見了? 其實在這裡啦~~
功能表列選擇 [插入] → [頁碼] 點進去
不管是點選頂端或是底端,很多人只看到4或5個選項,就想說那我要「第幾頁,共幾頁」是要怎麼設定,其實都沒注意到旁邊有捲軸可以往下拉,往下捲動有很多樣式可以選喔~
- Dec 21 Tue 2021 17:06
[PHP][轉] 小數點不足補零
參考網址:
http://fanli7.net/a/bianchengyuyan/PHP/20100930/40653.html
http://blog.hsin.tw/2009/php-pad-a-string/
最近做了一個案子非台幣為貨幣,因此會有小數點的問題。
我想實作出紙個網站是統一格式。
例:
$85.5統一顯示$85.50
$80統一顯示$80.00
但php 直接 echo 卻無法呈現我想要的效果
他只會顯示85.5.......這不是我要的阿...
於是爬了文找到補零方法
我的需求是要做到小數二位數因此要這麼做..
$money=85.5
echo sprintf(”%01.2f”,$money); //會印出85.50
成功!!
相關文章:
--
- Dec 16 Thu 2021 14:15
[Laravel] Use static variables in Laravel
- Dec 14 Tue 2021 15:48
[PHP][轉] 幾行代碼輕鬆實現PHP文件打包下載zip
- Dec 01 Wed 2021 16:18
[dataTable][轉] How to Export Multiple Row Headers in jQuery Datatables?
- Dec 01 Wed 2021 11:23
[PHP][轉] strpos — 查找字符串首次出现的位置
[php]strpos — 查找字符串首次出现的位置
官方範例1
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
// 注意這裡使用的是 ===。簡單的 == 不能像我們期待的那樣工作,
// 因為 'a' 是第 0 位置上的(第一個)字符。
if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}
?>
官方範例2
<?php
$mystring = 'abc';
$findme = 'a';
$pos = strpos($mystring, $findme);
// 使用 !== 操作符。使用 != 不能像我們期待的那樣工作,
// 因為 'a' 的位置是 0。語句 (0 != false) 的結果是 false。
if ($pos !== false) {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
} else {
echo "The string '$findme' was not found in the string '$mystring'";
}
?>
官方範例3
<?php
// 忽視位置偏移量之前的字符進行查找
$newstring = 'abcdef abcdef';
$pos = strpos($newstring, 'a', 1); // $pos = 7, 不是 0
?>
--
- Nov 25 Thu 2021 18:10
[轉][PHP] PHP 等比例縮圖程式
這是一個不錯的PHP 縮圖程式,找到的時候好興奮說
使用上很方便,只要照著自己需求去設定就可以囉
- Nov 25 Thu 2021 18:07
[PHP][轉] PHP 刪除目錄和以下檔案
- Nov 24 Wed 2021 15:09
[PHP][轉] PHP Try Catch
注意:Laravel使用try catch要先use Exception;
否則會出現 Class 'App\Http\Controllers\Exception' not found 的 error msg
- Nov 24 Wed 2021 10:54
[dataTable] drawCallback取得換頁後的該頁資料
- Nov 24 Wed 2021 10:49
[jQuery] jquery選擇一個帶有冒號的ID
Q:
我正在爲一個站點編寫一個預先編寫的模塊,並且我需要定位一個ID爲test:two
的元素。現在,這個元素有一個冒號,所以jquery大概可以理解地把'two'看作一個僞類。有什麼方法可以用jQuery來定位這個元素嗎?jquery選擇一個帶有冒號的ID
- Nov 24 Wed 2021 10:35
[PHP][轉] max_input_vars導致PHP Post 變量上限1000的解決方法
- Nov 11 Thu 2021 09:33
[PhpspreedSheet] 設定超鏈結 hyperlink 文字樣式(藍色&底線)
- Nov 10 Wed 2021 16:05
[PHP][轉] 如何在php中使用curl下載檔案?
- Nov 10 Wed 2021 13:54
[sweetalert2] SweetAlert2 - Bind another event to cancel button? 取得取消按鈕event
- Nov 10 Wed 2021 13:51
[PhpspreedSheet] 加入超鏈結 hyperlink
- Nov 05 Fri 2021 16:41
[jQuery] 表格匯出成excel檔 - tableExport.jquery.plugin
網路上找了一圈可以把 HTML table匯出成excel檔的js
- Nov 04 Thu 2021 15:06
[moment.js] Format datetime to YYYY-MM-DD HH:mm:ss in moment.js