php 隨機顯示圖片的函數

/*** 功能:隨機顯示圖片* Filename : img.php* Usage:* * * Edit: bbs.it-home.org**/ if($_GET['folder']){ $folder=$_GET['folder']; }else{ $folder='/images/'; } //存放圖片檔案的位置 $path = $_SERVER['DOCUMENT_ROOT']."/".$folder;

php使用memcache實現多伺服器共用session

[Session]; Handler used to store/retrieve data.session.save_handler = files ;

php簡單日曆的實現代碼(可綁定事件)

/*** 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)); //當月第一天是星期幾//年連結

php刪除一組檔案的例子

複製代碼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

php日曆代碼(附示範效果)

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); // 擷取本月第一天

php擷取檔案夾大小的函數

// 擷取檔案夾大小 function getDirSize($dir) { $handle = opendir($dir); while (false!==($FolderOrFile = readdir($handle))) { if($FolderOrFile != "." && $FolderOrFile != "..") {

PHP get_headers檢測遠端檔案是否存在的方法

$url = 'http://example.com'; $hander_array = get_headers ( $url ); if ($header_array [0] == 'HTTP/1.1 200 OK') { echo '檔案存在'; } else { echo '檔案不存在'; }

php日曆代碼 三個不錯的php日曆代碼

/** * 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 =

PHP 資料庫讀寫分離的經典例子

/*** mysql讀寫分離* edit: bbs.it-home.org*/class db { public function __construct($sql) { $chestr = strtolower(trim($sql)); //判斷sql語句有select關鍵字的話,就串連讀的資料庫,否則就串連寫資料庫 if(substr($chestr,0,6)=='select') {

PHP強制顯示出錯資訊的實現方法

error_reporting(E_ALL);ini_set('display_errors', '1');//將出錯資訊輸出到一個文字檔ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); 複製代碼更多有關error_reporting的內容,請參考:php中error_reporting()函數的用法參考教你開啟PHP的error_log日誌的方法php

php 讀取目錄資料夾清單的例子

/*** 讀取目錄列表的函數* edit: bbs.it-home.org*/function GetFolders( $resourceType, $currentFolder ){ // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ) ; // Array that will hold the

php 讀取檔案夾與檔案夾中檔案的函數

/*** 讀取檔案夾及其中檔案的函數* edit: bbs.it-home.org**/function GetFoldersAndFiles( $resourceType, $currentFolder ){ // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ; //

php遍曆檔案夾並實現編輯與刪除的代碼

/* 遍曆檔案夾; 功能:(a)可刪除檔案 (b)可編輯文本,網頁檔案 (c)可刪除檔案夾,前提是該檔案夾為空白 (d)可建立檔案,檔案夾,修改檔案夾名稱; */ $path=$DOCUMENT_ROOT; $path=str_replace("/","\\",$path); //指定檔案夾 $path=$path."\\"; if($_GET['folder']) { $path.=$_GET['folder']."\\"; } //本頁面路徑,下面傳回時將用到; $url=$_SERVER[

php數組去重的函數程式碼範例

/*** 去除數組中重複值的函數* by bbs.it-home.org*/function array_assoc_unique($arr, $key) { $tmp_arr = array(); foreach($arr as $k => $v) { if(in_array($v[$key], $tmp_arr)) { unset($arr[$k]); } else { $tmp_arr[] = $v[$key];

php 柱狀圖產生的簡單例子 jpgraph類庫執行個體

/*** 使用JpGraph產生柱狀圖* by bbs.it-home.org*/  require_once '../jpgraph/src/jpgraph.php';  require_once '../jpgraph/src/jpgraph_line.php';  require_once '../jpgraph/src/jpgraph_bar.php';  // y 軸資料,以數組形式賦值  $ydata = array(12,4,9,15,11,10,9,7,15,7);  //

php檔案上傳的簡單例子(初學入門)

/*** php 檔案上傳* 2013-11-30*/if($_POST[sub]){if(is_uploaded_file($_FILES[file][tmp_name])){//判斷是否取到臨時檔案,並儲存php內部。傳回值為1為真。$file=$_FILES[file];print_r($file); // bbs.it-home.org$name=$file[name];$tmp=$file[tmp_name];$size=$file[size];$error=$file[error];

php函數指定預設值的方法樣本

php函數指定預設值-bbs.it-home.orgfunction printMe($param = NULL){ print $param;}printMe("This is test");printMe();?> 複製代碼輸出結果:This is test例2,php函數參數預設值的使用範例,php函數參數中設定和使用預設值。代碼: php函數參數預設值 - bbs.it-home.org function textonweb ($content,

php flashchart柱狀圖產生執行個體

//url形式function embSwfWithUrl(dataurl,divcon){ var params = { "wmode": "transparent", "menu": "false", "scale": "noScale", "allowFullscreen": "false", "allowScriptAccess": "always", "bgcolor": "#c0c0c0"

判斷php數組維度(php數組長度)的方法

/** * 返回數組的維度 * @param [type] $arr [description] * @return [type] [description] */ bbs.it-home.orgfunction arrayLevel($arr){ $al = array(0); function aL($arr,&$al,$level=0){ if(is_array($arr)){ $level++;

php在圖片上繪製正餘弦曲線的方法

/*** 圖片上繪製正餘弦曲線的方法* edit:bbs.it-home.org*/ define("MAX_WIDTH_PIXEL", 600); define("MAX_HEIGHT_PIXEL", 240); //發送標題資訊 header("Content-type: image/gif"); //建立映像 $img = imageCreate(MAX_WIDTH_PIXEL, MAX_HEIGHT_PIXEL); //設定顏色 $bgcolor =

總頁數: 5203 1 .... 4376 4377 4378 4379 4380 .... 5203 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.