Time of Update: 2016-07-25
/*** 建立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
Time of Update: 2016-07-25
//取消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});)/’,
Time of Update: 2016-07-25
//未考慮浮點型/* * 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);
Time of Update: 2016-07-25
本公司正在構建一個以分享經濟為主題的大型行業交易平台,尋找懂網站平台開發,熟悉PHP、MySQL、JAVA、Android、iOS,能獨立完成網站架構和組織項目開發的技術牛人作為創業夥伴,籌備期您可以兼職的方式參與,最大限度減輕您的機會成本,有意者請發郵件至2975782162@qq.com。本公司將會擇優安排面談。
Time of Update: 2016-07-25
//----------------------------------------------------//函數名:csubstr//作 用:截字串,漢字一個算兩個字元,英文算一個字元//針對GBK(GB2312)編碼的網站//參 數:$str ----原字串// $start ----開始長度// $len ----截取長度//傳回值:截取後的字串//整理人:itlearner//-------------------------------------
Time of Update: 2016-07-25
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!");
Time of Update: 2016-07-25
/** 功能:PHP圖片浮水印 (浮水印支援圖片或文字)* 參數:* $groundImage 背景圖片,即需要加浮水印的圖片,暫只支援GIF,JPG,PNG格式;* $waterPos 浮水印位置,有10種狀態,0為隨機位置;* 1為頂端居左,2為頂端置中,3為頂端居右;* 4為中部居左,5為中部置中,6為中部居右;* 7為底端居左,8為底端置中,9為底端居右;* $waterImage 圖片浮水印,即作為浮水印的圖片,暫只支援GIF,JPG,PNG格式;* $waterText 文字浮水印,
Time of Update: 2016-07-25
// 請求 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
Time of Update: 2016-07-25
$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?>
Time of Update: 2016-07-25
/** 說明:產生隨機碼,並用圖形方式顯示隨機碼。*/$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
Time of Update: 2016-07-25
//// 函數名: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
Time of Update: 2016-07-25
/** * 建立圖片縮圖,成功返回真 * * @param string $cat 目錄 * @param string $oldname 原圖檔案名稱 * @param string $newname 新圖檔案名稱 * @param int $width 縮圖寬 * @param int $height 縮圖高 * @return */function
Time of Update: 2016-07-25
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 =
Time of Update: 2016-07-25
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() != '
Time of Update: 2016-07-25
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 =
Time of Update: 2016-07-25
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’,'
Time of Update: 2016-07-25
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
Time of Update: 2016-07-25
/* * 用於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){
Time of Update: 2016-07-25
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 =
Time of Update: 2016-07-25
/** 統計字串長度*@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;}