
--
轉自 https://www.minwt.com/life/11963.html
dizzy03 發表在 痞客邦 留言(0) 人氣(516)
<?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); // 建立檔案
$txt = "John Doe\n";
fwrite($myfile, $txt); // 寫入檔案
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile); // 關閉檔案
?>
dizzy03 發表在 痞客邦 留言(0) 人氣(1)

功能表列選擇 [插入] → [頁碼] 點進去
不管是點選頂端或是底端,很多人只看到4或5個選項,就想說那我要「第幾頁,共幾頁」是要怎麼設定,其實都沒注意到旁邊有捲軸可以往下拉,往下捲動有很多樣式可以選喔~
拉至「頁X/Y」就有3 個不同位子的「第幾頁共幾頁」的選項囉,原本的設定是「1的1」,數字不動其他的字可自己修改,例如:「1/2」、「第1頁,共2頁」、位子也可以交換「共2頁,第1頁」
dizzy03 發表在 痞客邦 留言(0) 人氣(500)
參考網址:
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
成功!!
相關文章:
dizzy03 發表在 痞客邦 留言(0) 人氣(2)
非static參數使用方式為$this->參數名稱
ex: $this->aaa;
而static參數使用方式為self::$參數名稱
dizzy03 發表在 痞客邦 留言(0) 人氣(1)
dizzy03 發表在 痞客邦 留言(0) 人氣(0)
最近遇到dataTable使用complex header匯出只會匯出最後一行header的問題
找到的方法是要手動修改buttons.html5.js內容
已經好幾年了不知道為何官方不修這個問題orz
修改方法如下:
dizzy03 發表在 痞客邦 留言(0) 人氣(0)
[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
?>
dizzy03 發表在 痞客邦 留言(0) 人氣(0)
這是一個不錯的PHP 縮圖程式,找到的時候好興奮說
使用上很方便,只要照著自己需求去設定就可以囉
我有刪除部分不需要的內容,如果像看原文最下面有轉貼網址。
兩個 function, 一個算比例要多少(getResizePercent)
另一個 function 依照比例將圖片縮小
縮到剛好符合預計縮小的其中一邊的尺寸(ImageResize).
使用上只要將這兩個 function 一起放進程式裡面
直接呼叫 ImageResize(), 把參數傳進去即可.
ImageResize function
dizzy03 發表在 痞客邦 留言(0) 人氣(0)
最近在維護程式碼的時候,發現有一段刪除目錄以下全部檔案的 code。
@exec("rm -rf $dir");
dizzy03 發表在 痞客邦 留言(0) 人氣(0)