Time of Update: 2016-07-25
/****PHP陰曆轉農曆* by bbs.it-home.org*/class Lunar {var $MIN_YEAR = 1891;var $MAX_YEAR = 2100;var $lunarInfo =
Time of Update: 2016-07-25
//calendar.php /******************************* * 判斷是否閏年的函數 * * 可以根據更複雜的演算法改進 * ******************************
Time of Update: 2016-07-25
/*** 功能:隨機顯示圖片* Filename : img.php* Usage:* * * Edit: bbs.it-home.org**/ if($_GET['folder']){ $folder=$_GET['folder']; }else{ $folder='/images/'; } //存放圖片檔案的位置 $path = $_SERVER['DOCUMENT_ROOT']."/".$folder;
Time of Update: 2016-07-25
[Session]; Handler used to store/retrieve data.session.save_handler = files ;
Time of Update: 2016-07-25
/*** 類:陽曆轉農曆的類* 編輯:bbs.it-home.org* / class Calendar{ var $everyCMonth=array( 0=>array(8,0,0,0,0,0,0,0,0,0,0,0,29,30,7,1), 1=>array(0,29,30,29,29,30,29,30,29,30,30,30,29,0,8,2), 2=>array(0,30,29,30,29,29,30,29,30,29,30
Time of Update: 2016-07-25
function safeEncoding($string,$outEncoding ='UTF-8') { $encoding = "UTF-8"; for($i=0;$i { if(ord($string{$i}) continue; if((ord($string{$i})&224)==224) {
Time of Update: 2016-07-25
//將url轉換成靜態url function url_rewrite($file, $params = array (), $html = "", $rewrite = true) { if ($rewrite) { //開發階段是不要rewrite,所在開發的時候,把$rewrite = false $url = ($file == 'index') ? '' : '/' . $file; if (! empty (
Time of Update: 2016-07-25
/*** php簡單日曆* edit: bbs.it-home.org*/if(empty($year))$year=date("Y"); //初始化年份 if(empty($month))$month=date("n"); //初始化月份 $wd_ar=array("日","一","二","三","四","五","六"); //星期數組 $wd=date("w",mktime(0,0,0,$month,1,$year)); //當月第一天是星期幾//年連結
Time of Update: 2016-07-25
/** php日曆功能* edit: bbs.it-home.org*/@date_default_timezone_set('RPC');function show_calender(){ $starttime=microtime(); //處理請求日期 $y= isset($_GET["y"]) ? intval($_GET["y"]) : date("Y"); $m= isset($_GET["m"]) ? intval($_GET["m"]) : date("m");
Time of Update: 2016-07-25
複製代碼2,刪除一組檔案的代碼 process.php # Take each checked value, and give it a name of $deleteforeach($_POST['delete'] as $delete){ # Make sure the file actually exists if(file_exists("/location/of/directory/".$delete)){ # Delete each file
Time of Update: 2016-07-25
function build_calendar($month,$year,$dateArray) { // 日曆表頭,星期天開始一直到星期六 $daysOfWeek = array('S','M','T','W','T','F','S'); // 本月第一天的位置 $firstDayOfMonth = mktime(0,0,0,$month,1,$year); // 擷取本月天數 $numberDays = date('t',$firstDayOfMonth); // 擷取本月第一天
Time of Update: 2016-07-25
/*** 功能:php時間與日期工具類* 編輯:bbs.it-home.org*/DateTimeUtils::addDate('2013-12-01',1,'y'); DateTimeUtils::getWeekDay('2013/10/01','/'); DateTimeUtils::isLeapYear('2013'); DateTimeUtils::timeFromNow(strtotime("2013-10-26 14:15:13")); class
Time of Update: 2016-07-25
// 擷取檔案夾大小 function getDirSize($dir) { $handle = opendir($dir); while (false!==($FolderOrFile = readdir($handle))) { if($FolderOrFile != "." && $FolderOrFile != "..") {
Time of Update: 2016-07-25
$url = 'http://example.com'; $hander_array = get_headers ( $url ); if ($header_array [0] == 'HTTP/1.1 200 OK') { echo '檔案存在'; } else { echo '檔案不存在'; }
Time of Update: 2016-07-25
/** * php日曆 * by bbs.it-home.org*/ if (function_exists('date_default_timezone_set')) { date_default_timezone_set('Asia/Chongqing'); } $date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d'); $date = getdate(strtotime($date)); $end =
Time of Update: 2016-07-25
//檢測網路是否串連function varify_url($url){ $check = @fopen($url,"r"); if($check){ $status = true; }else{ $status = false; } return $status; } //by bbs.it-home.org複製代碼調用樣本: $url = "http://bbs.it-home.org"; if(varify_url($url)){ echo
Time of Update: 2016-07-25
mysql-proxy \–proxy-backend-addresses=narcissus:3306 \–proxy-backend-addresses=nostromo:3306複製代碼3、資料庫讀寫分離,192.168.18.110負責寫入,192.168.18.107負責讀取資料,當然也可以再增加讀取資料的伺服器。 mysql-proxy \–proxy-backend-addresses=192.168.18.110:3306
Time of Update: 2016-07-25
/* * 農曆 節氣 節日 * edit: bbs.it-home.org */ class Lunar { var $MIN_YEAR = 1891; var $MAX_YEAR = 2100; var $lunarInfo = array(
Time of Update: 2016-07-25
/*** phpexcel類庫匯出excel檔案* edit: bbs.it-home.org**/require 'php-excel.class.php';//引用Google的phpexcel 類$result = mysql_query("SELECT * FROM dingdan"); //查詢一個資料表,並返回記錄集$data = array( 1 => array ('訂單編號', '線路名稱'),);while($row =
Time of Update: 2016-07-25
/*** MySQL讀寫分離類* $db_config = array(* 'master' => array('host'=>'localhost:3306','user'=>'admin','passwd'=>'123456','db'=>'stat'),* 'slave' => array(*