Time of Update: 2016-07-25
/*** 顏色值與16進位數位轉換* edit: WWW.JBXUE.COM*/function toHex($N) { if ($N==NULL) return "00"; if ($N==0) return "00"; $N=max(0,$N); $N=min($N,255); $N=round($N); $string = "0123456789ABCDEF"; $val = (($N-$N%16)/16); $s1 = $string{
Time of Update: 2016-07-25
$users = file("./demoCSV.csv"); foreach ($users as $user) { list($name, $email, $phone) = explode(",", $user); echo "$name ($email) Tel. $phone"; } //edit by
Time of Update: 2016-07-25
/*** 定義與使用php抽象類別* edit: bbs.it-home.org*/ abstract class Number { private $value; abstract public function value(); public function reset() { $this->value = NULL; } } class Integer
Time of Update: 2016-07-25
/*** 取出指定目錄的所有子目錄* edit: bbs.it-home.org* 2013/10/9*/function listdir($dir){ if ($handle = opendir($dir)){ $output = array(); while (false !== ($item = readdir($handle))){ if (is_dir($dir.'/'.$item) and $item != "." and
Time of Update: 2016-07-25
/*** 匯出excel檔案* by bbs.it-home.org*/function xlsBOF() { echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0); return; } function xlsEOF() { echo pack("ss", 0x0A, 0x00); return; } function xlsWriteNumber($Row, $Col, $Value) { echo
Time of Update: 2016-07-25
/*** 判斷搜尋引擎來路 跳轉網頁* edit: bbs.it-home.org*/$flag = false;$tmp = $_SERVER['HTTP_USER_AGENT'];if(strpos($tmp, 'Googlebot') !== false){ $flag = true;} else if(strpos($tmp, 'Baiduspider') >0){ $flag = true;} else if(strpos($tmp, 'Yahoo! Slurp') !==
Time of Update: 2016-07-25
/*** 將csv檔案匯入到mysql資料庫* edit: bbs.it-home.org*/$databasehost = "localhost";$databasename = "test";$databasetable = "sample";$databaseusername ="test";$databasepassword = "";$fieldseparator = ",";$lineseparator = "\n";$csvfile = "filename.csv";/******
Time of Update: 2016-07-25
/*** 讀取設定檔* edit: WWW.JBXUE.COM*/$encodename='存在的字元';$lines = @file('ske.txt');var_export($lines);if(in_array($encodename,$lines))//在這裡判斷失敗,原因在於:file讀出的數組包含了換號符號。複製代碼解決辦法: $lines =array_map('rtrim',file('ske.txt'));var_export($lines);
Time of Update: 2016-07-25
class Employee { //定義常量 const AVAILABLE = 0; const OUT_OF_STOCK = 1; public $status;}print Employee::AVAILABLE;?>複製代碼例2,定義類中的常量 class math_functions { //定義常量 const PI = '3.14159265'; const E = '2.7182818284';
Time of Update: 2016-07-25
本文為大家介紹下,學習php編程到底需要掌握哪些東西?初學php應該好好閱讀下本篇文章,一定會大有啟發的。學習php究竟需要掌握哪些東西呢?請看本文的介紹吧。1、文法:必須比較熟悉,在寫代碼時IDE的編輯器對某一行報錯應該能夠根據報錯資訊知道是什麼樣的語法錯誤並且知道任何修正。2、命令:必須熟悉PHP帶的一些常用命令及其常用選項,熟悉那些命令,自己運行php.exe -h
Time of Update: 2016-07-25
function xlsBOF() {echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);return;}function xlsEOF() {echo pack("ss", 0x0A, 0x00);return;}function xlsWriteNumber($Row, $Col, $Value) {echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);echo pack("d", $Value);
Time of Update: 2016-07-25
//定義一個抽象類別 abstract class Staff { abstract function hire(); abstract function fire(); abstract function promote(); abstract function demote(); }?>複製代碼例2,php抽象類別的例子 class Employee { private $title; private $lastName;
Time of Update: 2016-07-25
net user mysqlstart ****microsoft /addnet localgroup users mysqlstart /del 複製代碼不屬於任何組如果MYSQL裝在d:\mysql ,那麼,給 mysqlstart 完全控制的許可權。然後,在系統服務中設定,MYSQL的服務屬性,在登入屬性當中,選擇此使用者 mysqlstart 然後輸入密碼,確定。重新啟動
Time of Update: 2016-07-25
ini_set("display_errors",1);//是否顯示報錯資訊ini_set('include_path', ini_get('include_path').';D:\\PHP\\PHPExcel 1.6.6\\Tests\\classes\\');//設定此頁麵包含路徑include "classes/PHPExcel.php";include "classes/PHPExcel/Writer/Excel5.php";//建立一個excel$objPHPExcel = new
Time of Update: 2016-07-25
//統計檔案夾的相關資訊//統計目錄數//格式化輸出目錄大小 單位:Bytes,KB,MB,GB function getFolderSize($path){ $totalsize = 0; $totalcount = 0; $dircount = 0; if ($handle = opendir ($path)) { while (false !== ($file = readdir($handle))) { $nextpath = $path . '/' .
Time of Update: 2016-07-25
header("content-type:text/html;charset=utf-8"); ?> /*** 簡單實用的php日曆代碼* edit: bbs.it-home.org*/if(!emptyempty($_GET)){ $year = $_GET['year']; $month = $_GET['month']; } if(emptyempty($year)){ $year = date('Y'); } if(emptyempty(
Time of Update: 2016-07-25
/** * 檔案目錄操作類 * 編輯:bbs.it-home.org * 例子: * $fileutil = new fileDirUtil(); * $fileutil->createDir('a/1/2/3'); 測試建立檔案夾 建一個a/1/2/3檔案夾 * $fileutil->createFile('b/1/2/3'); 測試建立檔案 在b/1/2/檔案夾下面建一個3檔案 *
Time of Update: 2016-07-25
/** * 擷取機器網卡的物理(MAC)地址* 目前支援WIN/LINUX系統 * 編輯: bbs.it-home.org**/ class MacAddInfo { var $return_array = array (); // 返回帶有MAC地址的字串數組 var $mac_addr; function MacAddInfo($os_type) { switch (strtolower ( $os_type
Time of Update: 2016-07-25
/*** 功能:讀取設定檔* 編輯:bbs.it-home.org* 最後修改:2013/10/11*/class Settings { var $_settings = array(); function get($var) { $var = explode('.', $var); $result = $this->_settings; foreach ($var as $key) {
Time of Update: 2016-07-25
/*php產生文字png圖片,調用方式:http://www.yourdomian.com/text_png.php3?msg=helloworld+class&rot=15&size=48&font=fonts/ARIAL.TTF */ Header("Content-type: image/png"); class textPNG { var $font = 'fonts/TIMES.TTF'; //預設字型. 相對於指令碼存放目錄的相對路徑. var $msg =