php監控日誌500、503錯誤並發送郵件提示的代碼

/*** 監控日誌 500 503錯誤* by bbs.it-home.org*/include("PHPMailer/class.phpmailer.php");//error_reporting(0);$mail = new PHPMailer();$mail->IsSMTP(); // telling the class to use SMTP$mail->SMTPDebug = 1; // enables SMTP

php檢測上傳excel檔案類型的範例程式碼

/** * Detect upload file type * 檢測上傳檔案的excel檔案類型 * @param array $file * @return bool $flag * @site bbs.it-home.org */ private function detectUploadFileMIME($file) { // 1.through the file extension judgement 03 or 07 $flag = 0

PHP去除重複圖片檔案的代碼

/*** 去除重複的圖片檔案* by bbs.it-home.org*/exec("find . -type f", $lines);$arr = array();$del = array();$n = 0;foreach($lines as $line){ $line = trim($line); if(!$line){ continue; } $n ++; $md5 = md5_file($line); if(isset($arr[$md5])){ $del[] = $line; //

PHP Mysql與jQuery實現檔案下載次數統計

CREATE TABLE IF NOT EXISTS `downloads` ( `id` int(6) unsigned NOT NULL AUTO_INCREMENT, `filename` varchar(50) NOT NULL, `savename` varchar(50) NOT NULL, `downloads` int(10) unsigned NOT NULL DEFAULT '1', PRIMARY KEY (`id`), UNIQUE KEY

php判斷一個數組是否為另一個數組子集的方法

// 快速的判斷$a數組是否是$b數組的子集 $a = array(135,138); $b = array(135,138,137); 複製代碼實現方法:方法1,for迴圈遍曆 $flag = 1; foreach ($a as $va) { if (in_array($va, $b)) { continue; }else { $flag = 0; break; } } if ($flag) {

PHP、Mysql、jQuery找回密碼的實現代碼

輸入您註冊的電子郵箱,找回密碼: 複製代碼當使用者輸入完郵箱並點擊提交後,jQuery先驗證郵箱格式是否正確,如果正確則通過向後台sendmail.php發送Ajax請求,sendmail.php負責驗證郵箱是否存在和發送郵件,並會返回相應的處理結果給前台頁面。jQuery代碼: $(function(){ $("#sub_btn").click(function(){ var email = $("#email").val(); var preg =

理想的程式員是什麼樣子

我算是靠坑蒙拐騙進了程式員的門,然後一路狂奔。26歲之前幾乎沒有任何寫代碼的經驗,研究生畢業卻意外選擇了一家不可能提供培訓的初創公司,在每日擔憂公司倒閉、害怕被炒魷魚以及同事冷落白眼的三重壓力下逆流而上,一年半後離職,已是擁有500萬使用者產品的後台主程。從前我對電腦技術心懷畏懼,認定技術高人一定有佛光籠罩,晝夜不息運鍵如飛日吐代碼上萬行。現在也算見過一些世面了,回首那段忐忑不安宛如初夜的過程,我卻不發覺有任何的勵志意味,而是視為一種理所當然。理想的程式員,和理想的建築師、理想的財務師、理想的按

PHP、MySql、jQuery 實現“頂”與“踩”投票功能

CREATE TABLE IF NOT EXISTS `votes` ( `id` int(10) NOT NULL AUTO_INCREMENT, `likes` int(10) NOT NULL DEFAULT '0', `unlikes` int(10) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO `votes` (`id`,

smarty中使用php函數的方法

/*** smarty模板引擎中使用php函數* by bbs.it-home.org*/require 'libs/Smarty.class.php'; $smarty=new Smarty; $smarty->compile_check=true; $smarty->debugging=true; $str1='testtesttesttest'; $str2='this is a'; $str3='指令碼 學堂

php 5.2.x 數組操作細節分享

$arr = array("a" => 1,"b" => 2,"c" => 3); 複製代碼如果這樣定義數組會報編譯錯誤: $arr = array("a" = 1,"b" = 2,"c" = 3); 複製代碼因此,定義數組的時候只能用 => 2、 $arr = array("a" => 1,"b" => 2,"c" => 3);echo $arr[0];echo $arr[1]; 複製代碼打出來的是一片空白。正確的列印方法: echo

php產生指定位元(長度)的隨機字串

/*** 產生指定長度的字串* by bbs.it-home.org*/function create_random_string($random_length) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $random_string = ''; for ($i = 0; $i $random_string .= $chars [mt_rand(0,

解決php下載excel無法開啟的問題

/*** php代碼實現excel檔案下載* edit: bbs.it-home.org*/if (file_exists(CACHE_PATH . $file_name)){ //$this->logger->error('file realpath:'.realpath(CACHE_PATH . $file_name)); header( 'Pragma: public' ); header( 'Expires: 0' ); header(

phpexcel匯出excel的經典執行個體

/*** phpexcel類庫匯出excel檔案* edit: bbs.it-home.org**/require 'php-excel.class.php';//引用Google的phpexcel 類$result = mysql_query("SELECT * FROM dingdan"); //查詢一個資料表,並返回記錄集$data = array( 1 => array ('訂單編號', '線路名稱'),);while($row =

php擷取數組中重複資料的實現代碼

function FetchRepeatMemberInArray($array) { // 擷取去掉重複資料的數組 $unique_arr = array_unique ( $array ); // 擷取重複資料的數組 $repeat_arr = array_diff_assoc ( $array, $unique_arr ); return $repeat_arr; } // 測試案例 $array = array (

php 替換敏感字串的類(附源碼)

/** string filter class * Date: 2013-01-09 * Author: fdipzone * Ver: v1.0 * Edit: bbs.it-home.org* Func: * public replace 替換非法字元 * public check 檢查是否含有非法字元 * private protect_white_list 保護白名單 * private resume_white_

PHPMyadmin設定檔詳解(經典)

$cfg['Servers'][$i]['user'] = 'root'; // MySQL user 訪問phpmyadmin使用的mysql使用者名稱 fg['Servers'][$i]['password'] = ''; // MySQL password (only needed對應上述mysql使用者名稱的密碼複製代碼D.認證方法 $cfg['Servers'][$i]['auth_type'] = 'cookie';

php5安裝GD庫步驟分享

cd libpng-1.2.40mv scripts/makefile.linux ./Makefile #一定要使用script下的Makefile ,不要通過./configure複製代碼產生: makemake install複製代碼2,下載freetype庫,很多GD函數都需要此庫的支援http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.3.5.tar.gz解壓後,進入目錄: cd

php unicode解碼工具(unicode編碼轉換器)

//Unicode編碼解碼轉換function unicode_encode($name){ $name = iconv('UTF-8', 'UCS-2', $name); $len = strlen($name); $str = ''; for ($i = 0; $i { $c = $name[$i]; $c2 = $name[$i + 1]; if (ord($c) > 0) {

php gd庫的安裝與PHP偽靜態

# tar zxvf httpd-2.2.6.tar.gz# cd httpd-2.2.6# ./configure --prefix=/usr/local/apache2 --enable-so --enable-track-vars --enable-proxy --enable-vhost-alias --enable-cache --enable-disk-cache --enable-mem-cache --enable-rewrite

linux下yum安裝php gd庫的全過程

[root@jbxue ~]# yum install php-gd*Setting up Install ProcessSetting up repositoriesbase 100% |=========================| 951 B 00:00update 100% |=========================| 951 B 00:00Reading

總頁數: 5203 1 .... 996 997 998 999 1000 .... 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.