php使用GD庫產生bmp格式的圖片(imagebmp)

/*** 建立bmp格式圖片** @author: legend* @description: create Bitmap-File with GD library* @version: 0.1** @param resource $im 映像資源* @param string $filename 如果要另存新檔檔案,請指定檔案名稱,為空白則直接在瀏覽器輸出* @param integer $bit 映像品質(1、4、8、16、24、32位)* @param integer

加強版的htmlspecialchars函數

//取消html代碼function shtmlspecialchars($string) {if(is_array($string)) {foreach($string as $key => $val) {$string[$key] = shtmlspecialchars($val);}} else {$string = preg_replace(‘/&((#(\d{3,5}|x[a-fA-F0-9]{4})|[a-zA-Z][a-z0-9]{2,5});)/’,

php實現大數以,作分隔字元分隔的代碼

//未考慮浮點型/* * method 1 * echo number_format($str,2,'.',','); */ /* method2 * 先反轉字串strrev 再str_split($str,3); $str = strrev($str); $arr = str_split($str,3);//987 $res = ''; $count = count($arr);

尋找技術牛人、創業夥伴

本公司正在構建一個以分享經濟為主題的大型行業交易平台,尋找懂網站平台開發,熟悉PHP、MySQL、JAVA、Android、iOS,能獨立完成網站架構和組織項目開發的技術牛人作為創業夥伴,籌備期您可以兼職的方式參與,最大限度減輕您的機會成本,有意者請發郵件至2975782162@qq.com。本公司將會擇優安排面談。

截取中文字元的函數-csubstr

//----------------------------------------------------//函數名:csubstr//作 用:截字串,漢字一個算兩個字元,英文算一個字元//針對GBK(GB2312)編碼的網站//參 數:$str ----原字串// $start ----開始長度// $len ----截取長度//傳回值:截取後的字串//整理人:itlearner//-------------------------------------

又一個產生圖片縮圖的函數

function photoThumb($p_thumb_file, $p_photo_file, $p_max_size, $p_quality = 75) { $pic = @imagecreatefromjpeg($p_photo_file); if ($pic) { $thumb = @imagecreatetruecolor ($p_max_size, $p_max_size) or die ("Can't create Image!");

一個加強版的php浮水印代碼

/** 功能:PHP圖片浮水印 (浮水印支援圖片或文字)* 參數:* $groundImage 背景圖片,即需要加浮水印的圖片,暫只支援GIF,JPG,PNG格式;* $waterPos 浮水印位置,有10種狀態,0為隨機位置;* 1為頂端居左,2為頂端置中,3為頂端居右;* 4為中部居左,5為中部置中,6為中部居右;* 7為底端居左,8為底端置中,9為底端居右;* $waterImage 圖片浮水印,即作為浮水印的圖片,暫只支援GIF,JPG,PNG格式;* $waterText 文字浮水印,

php通過讀取文本進行郵件群發的程式

// 請求 PHPmailer類 檔案require_once("class.phpmailer.php");//發送Email函數function smtp_mail ( $sendto_email, $subject, $body, $extra_hdrs, $user_name) {$mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host = "smtp.163.com"; // SMTP

php擷取中文字串長度的方法

$str = 'Hello world!';echo strlen($str); // 輸出12?> 複製代碼然而在PHP內建的函數中,strlen及mb_strlen都是通過計算字串所佔位元組數來計算長度的,在不同的編碼情況下,中文所佔的位元組數是不同的。在GBK/GB2312下,中文字元佔2個位元組,而在UTF-8下,中文字元佔3個位元組。 $str = '你好,世界!';echo strlen($str); // GBK或GB2312下輸出12,UTF-8下輸出18?>

php產生隨機碼的一段代碼

/** 說明:產生隨機碼,並用圖形方式顯示隨機碼。*/$ViewRandomCode = mt_rand(1000,10000);session_start();$_SESSION['checksum'] = $ViewRandomCode;function set_4pixel($r, $g, $b, $x, $y){global $sx, $sy, $pixels;$ofs = 3 * ($sx * $y + $x);$pixels[$ofs] = chr($r);$pixels[$ofs

一個判斷是否為指定長度內字串的函數

//// 函數名:CheckLengthBetween($C_char, $I_len1, $I_len2=100)// 作 用:判斷是否為指定長度內字串// 參 數:$C_char(待檢測的字串)// $I_len1 (目標字串長度的下限)// $I_len2 (目標字串長度的上限)// 傳回值:布爾值// 備 註:無function CheckLengthBetween($C_cahr, $I_len1, $I_len2=100){$C_cahr = trim($C_cahr);if

一個建立圖片縮圖的函數

/** * 建立圖片縮圖,成功返回真 * * @param string $cat 目錄 * @param string $oldname 原圖檔案名稱 * @param string $newname 新圖檔案名稱 * @param int $width 縮圖寬 * @param int $height 縮圖高 * @return */function

有關phpmailer的用法

require("phpmailer/class.phpmailer.php"); function smtp_mail( $sendto_email, $subject, $body, $extra_hdrs, $user_name){ $mail = new PHPMailer(); $mail->IsSMTP(); // send via SMTP $mail->Host =

Codeigniter處理使用者登入驗證後URL跳轉的代碼

class MY_Controller extends CI_Controller{ public function __construct() { parent::__construct(); /*判斷是否登入,判斷當前URL是否是auth/login*/ if ( ! $this->tank_auth->is_logged_in() && ( $this->router->fetch_class() != '

一個比較穩定的php登陸系統驗證碼

session_start(); $type = 'gif'; $width= 56; $height= 22; header("Content-type: image/".$type); srand((double)microtime()*1000000); $randval = randStr(4,"NUMBER"); if($type!='gif' && function_exists('imagecreatetruecolor')){ $im =

php寫的一個驗證碼

session_start();$image = imagecreatetruecolor(58,22);$color_Background = imagecolorallocate($image,255,255,255);imagefill($image,0,0,$color_Background);$key = array(‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,‘a’,'b’,'c’,'d’,'e’,'f’,'g’,'h’,'i’,'j’,'k’,'

php實現的一個UTF8編碼轉Unicode的函數

function Utf8ToUnicode(strUtf8){var bstr = “”;var nTotalChars = strUtf8.length; // total chars to be processed.var nOffset = 0; // processing point on strUtf8var nRemainingBytes = nTotalChars; // how many bytes left to be convertedvar

用於utf8編碼的字串截取的函數

/* * 用於utf8編碼的字串截取*/function utf8_substr($str,$position,$length){ $start_position = strlen($str); $start_byte = 0; $end_position = strlen($str); $count = 0; for($i = 0; $i if($count >= $position && $start_position > $i){

最佳化了的addslashes函數

function daddslashes($string, $force = 0) { if(!$GLOBALS['magic_quotes_gpc'] || $force) { if(is_array($string)) { foreach($string as $key => $val) { $string[$key] = daddslashes($val, $force); } } else { $string =

UTF-8與GBK編碼下PHP擷取字串長度的函數

/** 統計字串長度*@param $str 被統計字串*/function sstrlen($str) {global $charset;$n = 0; $p = 0; $c = ”;$len = strlen($str);if($charset == ‘utf-8′) {for($i = 0; $i $c = ord($str{$i});if($c > 252) {$p = 5;} elseif($c > 248) {$p = 4;} elseif($c > 240) {$p = 3;}

總頁數: 5203 1 .... 1534 1535 1536 1537 1538 .... 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.