whois 查詢的PHP代碼

使用下面的函數可以擷取任何網域名稱使用者的完整細節 function whois_query($domain) { // fix the domain name: $domain = strtolower(trim($domain)); $domain = preg_replace('/^http:\/\//i', '', $domain); $domain = preg_replace('/^www\./i', '', $domain); $domain =

php批量遞迴刪除檔案夾以檔案

php內建的rmdir,只能刪除空目錄,這個rrmdir就可以遞迴刪除目錄及目錄下的所有檔案 function rrmdir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != “.” && $object != “..”) { if (filetype($dir.”/”.$object) ==

php數字轉為漢字金額

/** * 數字轉換為中文 * @param string|integer|float $num 目標數字 * @param integer $mode 模式[true:金額(預設),false:普通數字表示] * @param boolean $sim 使用小寫(預設) * @return string */ function number2chinese($num,$mode = true,$sim = true){

PHP阻止多個 IP 訪問你的網站

這個程式碼片段可以方便你禁止某些特定的 IP 位址訪問你的網站 if ( !file_exists('blocked_ips.txt') ) { $deny_ips = array( '127.0.0.1', '192.168.1.1', '83.76.27.9', '192.168.1.163' );} else { $deny_ips = file('blocked_ips.txt');}// read user ip adress:$ip =

php檢測是否是行動裝置的瀏覽器

這段代碼可以檢測使用者是否使用行動裝置瀏覽網頁,檢驗非常完整 $mobile_browser = '0'; if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($_SERVER['HTTP_USER_AGENT']))){ $mobile_browser++; }

php實現二分尋找演算法

// $low and $high have to be integers function BinarySearch( $array, $key, $low, $high ){ if( $low > $high ) // termination case { return -1; } $middle = intval( ( $low+$high )/2 ); // gets the middle of the array if ( $array[

PHP判斷一張圖片的主色調的程式碼片段

這段代碼可以協助你判斷任意圖片的主色調,使用了簡單的統計演算法實現 $i = imagecreatefromjpeg("image.jpg"); for ($x=0;$x for ($y=0;$y $rgb = imagecolorat($i,$x,$y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> & 0xFF; $b = $rgb & 0xFF;

PHP支援發送HTML格式郵件的發送類

/** * 郵件發送類 * 支援發送純文字郵件和HTML格式的郵件 * @example * $config = array( * "from" => "*****", * "to" => "***", * "subject" => "test", * "body" => "test", * "username" => "***", *

PHP的檔案操作

//filetype()擷取檔案的類型//擷取windows下的檔案類型echo filetype("D:\\lamp\\php5\\php.ini")."";//輸出file 表示是一個普通檔案echo filetype("D:\\lamp\\php5")."";//輸出dir 表示是一個目錄//is_file()判斷給定的檔案名稱是否是一個普通檔案//is_dir()判斷給定的檔案名稱是否是一個目錄//file_exists()檢查檔案或目錄是否存在//filesize()取得檔案的大小//

PHP 檔案本身操作

//檔案本身的操作 //copy()複製檔案 //unlink()刪除檔案 //ftruncate()將檔案截斷到指定的長度 //rename()重新命名檔案或目錄 if(copy("data.txt","data_bak.txt")){//複製檔案執行個體 echo "檔案複製成功"; }else{ echo "檔案複製失敗"; } if(file_exists("data_bak.txt")

php簡單驗證碼的製作

$image=imagecreatetruecolor(100, 30);$white=imagecolorallocate($image, 255, 255, 2);$red=imagecolorallocate($image, 255, 0, 0);imagefill($image, 0, 0, $white);//munber create$num="";for($i=0;$i $num.=rand(1,9);}imagestring($image, 6, rand(10,

phpRegex取得內容所有連結的方法

本文執行個體講述了phpRegex取得內容所有連結的方法。分享給大家供大家參考。具體如下: 這裡提供二款關於php正則連結的方法,他們可以取得內容所有連結並且儲存到一個數組,當然也可以把連結全部替換. 方法一,代碼如下: function get_all_url($code){ preg_match_all('/"' ]+)["|']?s*[^>]*>([^>]+)/i',$code,$arr); return array('name'=>$arr[2],

使用PHPMailer來發送帶圖片的 HTML Emails

require("class.phpmailer.php");$mail = new PHPMailer();$mail = new PHPMailer();$mail->IsSMTP();$mail->Host = "smtp1.example.com;smtp2.example.com";$mail->SMTPAuth = true;$mail->Username = 'smtpusername';$mail->Password = 'smtppassword'; $mail->From="

PHP 多維陣列進行排序

/* function:二維數組按指定的索引值排序 $array=array( 0=>array('id'=>8,'username'=>'phpernote'), 1=>array('id'=>9,'username'=>'com'), 2=>array('id'=>5,'username'=>'www') ); 現在需要將這個二維數組按id升序排列,則: array_sort($array,'id','asc'); */ public function array_

PHP 添加浮水印 & 比例縮圖 & 固定高度 & 固定寬度 類。

//PHP 添加浮水印 & 比例縮圖 & 固定高度 & 固定寬度 類。 class Image_process{ public $source; //原圖 public $source_width; //原圖寬度 public $source_height; //原圖高度 public $source_type_id; public $orign_name; public $orign_dirname; /

ftp上傳檔案的php指令碼

大概原理 遍曆項目中的所有非排除檔案,然後擷取 檔案修改時間晚於檔案上一次修改時間 的檔案 然後將這些檔案,通過ftp上傳到對應的目錄 具體代碼如下: 因為只是工具,代碼很亂,見諒 error_reporting(7);if ($_SERVER['SERVER_ADDR'])exit;//禁止在web伺服器下運行$_GET['exclude'] =

PHP計算兩個日期的差

$date1 = date( 'Y-m-d' );$date2 = "2015-12-04";$diff = abs(strtotime($date2) - strtotime($date1));$years = floor($diff / (365*60*60*24));$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));$days = floor(($diff - $years * 365*60*60*24 - $

PHP解壓ZIP檔案

function unzip($location,$newLocation){ if(exec("unzip $location",$arr)){ mkdir($newLocation); for($i = 1;$i $file = trim(preg_replace("~inflating: ~","",$arr[$i])); copy($location.'/'.$file,

PHP使用 mail() 發送郵件

之前我們提供了如何使用 Mandrill 發送郵件的 PHP 程式碼片段,但是如果你不想使用第三方服務,那麼可以使用下面的 PHP 程式碼片段。 function send_mail($to,$subject,$body){$headers = "From: KOONK\r\n";$headers .= "Reply-To: blog@koonk.com\r\n";$headers .= "Return-Path: blog@koonk.com\r\n";$headers .=

PHP提取任意圖片的主顏色

function dominant_color($image){$i = imagecreatefromjpeg($image);for ($x=0;$x for ($y=0;$y $rgb = imagecolorat($i,$x,$y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> & 0xFF; $b = $rgb & 0xFF; $rTotal += $r;

總頁數: 5203 1 .... 2472 2473 2474 2475 2476 .... 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.