Time of Update: 2016-07-25
function EncodeHeader ($str, $position = 'text', $pl = 0) {if ( $pl ) return "=?" . $this->CharSet . "?B?" . base64_encode($str) . "?=";複製代碼為這個函數多定義的一個參數。自然要修改所有調用這個函數的地方的參數。尋找:EncodeHeader(如下類似這樣的都要改: $result .= $this->HeaderLine("Subject",
Time of Update: 2016-07-25
/** * PHPMailer郵件發送 * Edit bbs.it-home.org*/ function smtp_main_send( $to, $subject, $message, $from, $fromName ) { $mail = new PHPMailer(); $mail->CharSet = "UTF-8"; // 設定編碼 $mail->IsSMTP(); // 設定使用SMTP服務發送 $mail->Host = "smtp.mail.com"; $
Time of Update: 2016-07-25
$d = date("Y-m-d H:i:s")複製代碼2、時間格式參數設定上面文法中”Y-m-d H:i:s”,顯示的格式為: 年-月-日 小時:分鐘:秒只要擷取對應的相關時間參數就可以替換出自己想要的時間格式了!附,php時間格式的參數說明。 a – “am” 或是 “pm”A – “AM” 或是 “PM”d – 幾日,二位元字,若不足二位則前面補零; 如: “01″ 至 “31″D – 星期幾,三個英文字母; 如: “Fri”F – 月份,英文全名; 如: “January”h – 12
Time of Update: 2016-07-25
本文介紹下,使用phpmailer發送yahoo郵件的例子,有需要的朋友,參考下吧。PHPMailer類發郵件的例子:IsSMTP();//郵件伺服器$mail->Host = "smtp.mail.yahoo.com.cn";$mail->SMTPDebug = 0;//使用SMPT驗證$mail->SMTPAuth = true;//SMTP驗證的使用者名稱稱$mail->Username =
Time of Update: 2016-07-25
/*** 內容關鍵詞的替換 * edit: WWW.JBXUE.COM*/$ci=array("短網址"=>"http://jbxue.com","網址縮短"=>"http://jbxue.com");//內容欄位是content$content="短網址是個好工具";foreach($ci as $k=>$v){ $str=''.$k.''; $content=ereg_replace($k,$str,$content);}echo
Time of Update: 2016-07-25
Header("HTTP/1.1 404 Not Found");複製代碼針對apache配置中的ErrorDocument 404 /404.php功能,把nginx配置中的 error_page 404 /404.php;複製代碼改成 error_page 404 = /404.php;複製代碼php heager 301 header("HTTP/1.1 301 Moved Permanently"); header ("Location:$url");
Time of Update: 2016-07-25
本文介紹下,隱藏php頭部的版本輸出x-powered-by的方法,有需要的朋友參考下。在php程式中,預設會輸出header資訊:(Status-Line) HTTP/1.1 200 OKDate Wed, 23 Feb 2011 02:30:46 GMTServer Apache/2.2.13 (Win32)X-Powered-By: PHP/5.2.3Content-Length 30Keep-Alive timeout=5, max=100Connection
Time of Update: 2016-07-25
//----------------- //檔案名稱 $filename = "test.swf"; //開啟檔案 $rs = fopen($filename, "r"); //讀取檔案的資料 $str = fread($rs, filesize($filename)); //設定swf標頭檔 $head = substr($str, 0, 8); $head[0] = 'F'; //擷取swf檔案內容 $body = substr($str, 8);
Time of Update: 2016-07-25
//curl類class Curl{ function Curl(){ return true; } function execute($method, $url, $fields='', $userAgent='', $httpHeaders='', $username='', $password=''){ $ch = Curl::create(); if(false === $ch){ return
Time of Update: 2016-07-25
本文介紹下,在php編程中,當上傳檔案過大時,$_files顯示為空白的解決辦法,有需要的朋友參考下。本節內容:解決PHP上傳檔案過大時$_FILES為空白的問題。在php開發的程式中,上傳圖片時,發現一張gif圖片上傳失敗 size為0,實際大小為4.66M。分享下PHP上傳檔案時檔案過大的解決方案。當上傳小檔案時可以,傳大檔案就不行,查看下PHP.INI裡面upload_max_filesize = 2M,問題往往出在這裡。修改其值: ; Maximum allowed size for
Time of Update: 2016-07-25
header("Content-Type: application/vnd.ms-excel") 複製代碼如果希望能夠提供那個開啟/儲存的對話方塊,Content-Disposition參數,Content-Disposition參數本來是為了在用戶端另存檔案時提供一個建議的檔案名稱,但是考慮到安全的原因,就從規範中去掉了這個參數。Content-Disposition參數:attachment --- 作為附件下載 inline --- 線上開啟具體使用: header("Content-
Time of Update: 2016-07-25
$db = mysql_connect(....);mysql_select_db(....);$fp = fopen('somefile.sql', 'r');while($fp != feof()){$line = fread($fp, 2048);$line = mysql_real_escape_string($db,
Time of Update: 2016-07-25
$filename = '路徑+實際檔案名稱'; //檔案的類型 header('Content-type: application/pdf'); //下載顯示的名字 header('Content-Disposition: attachment; filename="儲存時的檔案名稱.pdf"'); readfile("$filename"); exit(); ?>複製代碼以下是網上常用的方法 if (isset($link)) { Header("HTTP/1.1 303 See
Time of Update: 2016-07-25
header("content-type: text/html; charset=utf-8");header("cache-control: no-cache, must-revalidate"); header("pragma: no-cache");error_reporting(0);ob_end_flush();?>//加了這句,看看能不能解決linux下顯示亂碼的問題?php 探針 v1.0 - bbs.it-home.org著作權資訊[基本資料] [進階資訊]if
Time of Update: 2016-07-25
$imageurl = 'http://127.0.0.1/1.png';$headers = get_headers($imageurl); 複製代碼其實圖片也是本地的一張圖片,但是確實是“遠程”的,遠程圖片也可以理解為url地址的圖片。使用抓包工具tcpdump監聽本地80連接埠: sudo tcpdump -i lo -nnA 'src port 80'複製代碼而後訪問test.php,抓到的包關鍵區段如下:可以看到圖片的內容也被請求回來了。最終確定下來get_headers是GET請求,
Time of Update: 2016-07-25
[code]class HtmlFilter{ /** * 過濾字串中的特殊字元 * @static * @param $content * @return string */ public static function filterSpacialHtmlChar($content) { if (empty($content)) { return ''; }
Time of Update: 2016-07-25
eaccelerator_lock(“count”); eaccelerator_put(“count”,eaccelerator_get(“count”)+1));?>複製代碼eaccelerator_unlock($key) 根據 $key 釋放鎖eaccelerator_cache_output($key, $eval_code, $ttl=0) 將 $eval_code 代碼的輸出緩衝 $ttl 秒,($ttl參數同 eacclerator_put) 例如:
Time of Update: 2016-07-25
$str = 'Compress meCompress meCompress meCompress meCompress meCompress meCompress meCompress meCompress me';echo "str".strlen($str)."\n";複製代碼方法1,壓縮率最低(gzip壓縮演算法) 產生結果可以直接寫到.gz檔案中 $data = implode("", file("bigfile.txt"));$gzdata = gzencode($data, 9);
Time of Update: 2016-07-25
//透明背景圖片header(‘content-type:text/html;charset=gbk’);$safess = $_get[safe];$dir = dirname(__file__).”/simsun.ttc”;$safe=iconv(“gb2312″,”utf-8″,$safess); $im=imagecreatetruecolor(160,18); $color=imagecolorallocate($im,229,231,230);
Time of Update: 2016-07-25
//偽造有100000個數組元素的數組,第一個數組元素為1,後面的99999個都為0 for($i=0;$i if($i==1) array_push($array,1); else array_push($array,0); } //第一種用迴圈方法 $len=count($array); for ($i=0; $i if($array[$i]!=$array[$i+1]){ break; } } // 耗時:Processed in 0.14