一個php上傳下載檔案的源碼

filelist $dir = 'upload/';if(is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file!="." && $file!="..") { echo "".$file.""; } }

PHP擷取ip對應地區和使用的網路類型

看到 http://www.oschina.net/code/snippet_106370_5983 這篇文章,測試的時候因為ip168網站禁止,所以試著在原有代碼上修改為ip138資料庫的資料調用 //原程式有問題,現修改為ip138資料庫 /** * 擷取IP地區 * Enter description here ... * @param

php類比post提交資料

php類比post提交資料,用處很多,可用來網站的採集,登陸等等 //以程式登陸一個論壇登入狀態例function bbslogin($user_login, $password, $host, $port = "80") {//需要提交的post資料$argv = array('cookie' => array('user_login' => $user_login,

php處理日期格式為秒前、分前、小時前、昨天、前天

出處:http://www.crazyphper.com /** * 將日期格式根據以下規律修改為不同顯示樣式 * 小於1分鐘 則顯示多少秒前 * 小於1小時,顯示多少分鐘前 * 一天內,顯示多少小時前 * 3天內,顯示前天22:23或昨天:12:23。 * 超過3天,則顯示完整日期。 *

jpge 與png圖片的融合

jpge圖片與png圖片的融合,其實就是大家熟悉的浮水印技術。下面代碼中最重要的一句為: //設定映像的混色模式 imagealphablending($ground_im, true); /* * 功能:PHP圖片浮水印 (浮水印支援圖片或文字) * 參數: * $groundImage 背景圖片,即需要加浮水印的圖片,暫只支援GIF,JPG,PNG格式; *

PHP subistr 截取字串無碼

更新時間:20120102 /** * [WebodMin] (C)2010-2099 Blank Inc. * This is NOT a freeware, use is subject to license terms ***/function subistr($string, $length, $dot = ' ...') { global $

php用於判斷檔案是否存在、是否可讀、目錄是否存在的代碼

$file = 'jbxue.com.php';if (is_readable($file) == false) {die('檔案不存在或者無法讀取');} else {echo '存在';}?>複製代碼is_readable() 函數判斷指定檔案名稱是否可讀.指定的檔案或目錄存在並且可讀,則返回 TRUE例2: $filename = 'jbxue.com.php';if (file_exists($filename)) {echo "The file $filename exists";}

php5中date()獲得的時間不是目前時間的解決方案

[Date]; Defines the default timezone used by the date functions;date.timezone =複製代碼預設是關閉的,只需把注釋去掉,改為即可 [Date]; Defines the default timezone used by the date functionsdate.timezone =

php檢測網址地址與http地址格式是否有效代碼

/** desc:檢網路地址格式是否有效 link:bbs.it-home.org date:2013/2/24*/function checkUrl($weburl) { return !ereg("^http(s)*://[_a-zA-Z0-9-]+(.[_a-zA-Z0-9-]+)*$", $weburl); } ?>複製代碼2、判斷http 地址是否有效 /** desc:檢測http 地址是否有效 link:bbs.it-home.org date:2013

php產生靜態頁面的詳細教程

{ title }this is a { file } file's templets 複製代碼PHP處理: templetest.php $title = "測試模板";$file = "TwoMax Inter test templet,author:Matrix@Two_Max"; $fp = fopen ("temp.html","r");$content = fread ($fp,filesize ("temp.html"));$content .= str_replace ("{

php產生靜態檔案的二種方法

ob_start();#開啟伺服器緩衝include_once 'Index.php';$ctx=ob_get_contents();#擷取緩衝ob_end_clean();#清空緩衝$fh=fopen("index.html","w+");fwrite($fh,$ctx);#寫入html,產生htmlfclose($fh);?>複製代碼方法2:php 靜態檔案產生類 class CreateHtml{function mkdir( $prefix= 'article' ){$y = date(

將網頁匯出為Word文檔的php代碼介紹

/** * 根據html代碼擷取word文檔內容 * 建立一個本質為mht的文檔,該函數會分析檔案內容並從遠程下載頁面中的圖片資源 * 該函數依賴於類MhtFileMaker * 該函數會分析img標籤,提取src的屬性值。但是,src的屬性值必須被引號包圍,否則不能提取 * * @param string $content HTML內容 * @param string $absolutePath

上傳圖片(帶內容可修改非函數)

實現上傳圖片的功能 date_default_timezone_set("PRC");header("content-type:text/html;charset=utf-8");require_once("./function1.php");if(isset($_GET['act']) && ($_GET['act']

php-redis中文文檔之五

本文是php-redis中文文檔的第五部分,有需要的朋友可以參考下。本文是php-redis中文文檔的第五部分,有需要的朋友可以參考下。Hash操作hSet$redis->hSet('h', 'key1', 'hello');向名稱為h的hash中添加元素key1—>hello hGet$redis->hGet('h', 'key1');返回名稱為h的hash中key1對應的value(hello) hLen$redis->hLen('h');返回名稱為h的hash中元素個數

php設定index.php檔案為唯讀方法

function set_writeable($file_name){if(@chmod($file_name,0555)){ echo "修改index.php檔案唯讀屬性成功";}else{ echo "修改index.php檔案唯讀屬性失敗,空間商不支援此操作!";}}set_writeable("index.php");?>

php擷取用戶端瀏覽器與作業系統資訊的方法

//顯示訪問使用者的瀏覽器資訊echo 'Browser: ' . determinebrowser($Agent) . '';//顯示訪問使用者的作業系統平台echo 'Platform: ' . determineplatform($Agent). '';//正值運算式比對解析$_SERVER['HTTP_USER_AGENT']中的字串 擷取訪問使用者的瀏覽器的資訊function determinebrowser ($Agent) {$browseragent="";

php解析XML文件屬性並編輯的代碼

//讀取xml $dom=new DOMDocument('1.0');$dom->load('data.xml');$em=$dom->getElementsByTagName('videos');//最外層節點$em=$em->item(0);$items=$em->getElementsByTagName('video');//節點//如果不用讀取直接添加的話把下面這一段去掉即可foreach($items as $a){foreach($a->attributes as

php寫的一個登入驗證類

final class UserLogin { public function __construct() { } public static function getUserInfo() { if (isset($_COOKIE["user_id"])&&$_COOKIE["user_id"]&&(trim($_COOKIE["user_id"])!="")) { if

php 數組排序方法分享(冒泡排序、選擇排序)

function maoPao($arr,$style)//預設傳遞的是值,不是地址。如果在$arr前加個&,則和$arr1指向同一個地址,函數外的$arr1也被排好了 { $temp=0; $flag=false; for($i=0;$i{ for($j=0;$j{ if($style=='bts') $op=$arr[$j]else if($style=='stb') $op=$arr[$j]>$arr[$j+1]; if($op) { $temp=$arr[$j];

PHP文章按日期(月日)歸檔的sql語句

select FROM_UNIXTIME(pubtime, '%Y-%m') as pubtime, count(*) as cnt from articles group by FROM_UNIXTIME(pubtime, '%Y-%m')複製代碼PHP文章按日期(日)SQL歸檔 select FROM_UNIXTIME(pubtime, '%Y-%m-%d') as pubtime, count(*) as cnt from articles group by

總頁數: 5203 1 .... 537 538 539 540 541 .... 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.