Time of Update: 2016-07-25
$reader = PHPExcel_IOFactory::createReader('Excel5'); // 讀取 excel 檔案方式 此方法是讀取excel2007之前的版本 excel2007 為讀取2007以後的版本 也可以查\Classes\PHPExcel\Reader 檔案夾中的類(為所有讀取類,需要哪個填上哪個就行)$PHPExcel = $reader->load("info.xls"); // 檔案名稱$sheet = $PHPExcel->getSheet(0); /
Time of Update: 2016-07-25
$cookie = new CHttpCookie('mycookie','this is my cookie'); $cookie->expire = time()+60*60*24*30; //有限期30天 Yii::app()->request->cookies['mycookie']=$cookie;複製代碼2,讀取cookie: $cookie = Yii::app()->request->getCookies(); echo
Time of Update: 2016-07-25
create table `test` (`id` int(10) unsigned not null auto_increment,`name` char(100) not null,`content` varchar(300) not null,primary key (`id`)) engine=myisam default charset=utf8 auto_increment=27 ;insert into `test` (`id`, `name`, `content`)
Time of Update: 2016-07-25
/** * @file class.qqhttp.php * qq郵箱登陸擷取類 * @author wc * @site bbs.it-home.org */ class QQHttp {
Time of Update: 2016-07-25
require_once 'classes/phpexcel/reader/excel2007.php'; require_once 'classes/phpexcel/reader/excel5.php'; include 'classes/phpexcel/iofactory.php'; function arraytoexcel($data){ $objphpexcel = new phpexcel();
Time of Update: 2016-07-25
Header( "HTTP/1.1 301 Moved Permanently" );Header( "Location: http://www.new-url.com" );?>複製代碼3. ASP Redirect Response.Status="301 Moved Permanently"Response.AddHeader "Location","http://www.new-url.com/"%>複製代碼4. ASP .NET Redirect 複製代碼5. JSP
Time of Update: 2016-07-25
本文介紹了php mysql編程中常用的轉義特殊字元的函數,包括mysql_escape_string與addslashes函數的用法,需要的朋友參考下。php mysql轉義特殊字元的函數 函數一是mysql_escape_string,函數二是addslashes。 mysql_escape_string與addslashes的區別在於 mysql_escape_string總是將“’”轉換成“\’”而addslashes 在magic_quotes_sybase=on時將“’”轉換成“””
Time of Update: 2016-07-25
require_once('include/common.inc.php'); require_once(rootpath . 'include/phpexcel/phpexcel/iofactory.php'); $filepath = './file/xls/110713.xls'; $filetype = phpexcel_iofactory::identify($filepath); //檔案名稱自動判斷檔案類型 $objreader =
Time of Update: 2016-07-25
public function actionTest() { $criteria=new CDbCriteria; $criteria->order='id DESC'; $count=User::model()->count($criteria); $pager=new CPagination($count); $pager->pageSize=10; $pager->applyLimit($criteria);
Time of Update: 2016-07-25
function datezhuanhuan($dateparams){$ccc=strtotime($dateparams);$date=date(‘Y-m-d');$bjtime=date(‘Y-m-d',$ccc);if($date==$bjtime){$sbjtime=date(‘Y-m-d H:i:s',$ccc);echo substr($sbjtime,11,5);} // bbs.it-home.orgelse{$sbjtime=date(‘Y-m-d H:i:s',$ccc);
Time of Update: 2016-07-25
本文介紹了一份php進階工程師面試題,之前程式員之家(bbs.it-home.org)介紹過很多php面試題,這裡再提供一個php進階工程師的面試題,有點難度,需要的朋友參考下。專題推薦:php面試題及答案php進階工程師面試題1,基本知識點http協議中幾個狀態代碼的含義:503 500 401 200 301 302。。。include require include_once require_once 的區別.php/mysql中幾個版本的進化史,比如mysql4.0到4.1,php 4.
Time of Update: 2016-07-25
/*** @功能:下載遠程圖片* @ bbs.it-home.org*/ function DownImageKeep($gurl, $rfurl, $filename, $gcookie="", $JumpCount=0, $maxtime=30) { $urlinfos = GetHostInfo($gurl); $ghost = trim($urlinfos['host']); if($ghost=='') { return
Time of Update: 2016-07-25
header("content-type:text/html; charset=xxx")AddDefaultCharset xxx複製代碼建議為每個頁面都加個header("content-type:text/html; charset=xxx"),這樣就可以保證它在任何伺服器都能正確顯示,可移植性也比較強。 4)、PHP.ini 中的 default_charset 配置: php.ini 中的 default_charset = "gb2312"
Time of Update: 2016-07-25
/** * * @copyright 2007-2012 xiaoqiang. * @author xiaoqiang.wu * @version 1.01 */ error_reporting(e_all); date_default_timezone_set('asia/shanghai'); /** phpexcel_iofactory */require_once '../classes/phpexcel/iofactory.php'; // check
Time of Update: 2016-07-25
/** * 圖片加浮水印(適用於png/jpg/gif格式) * * @author flynetcn * * @param $srcImg 原圖片 * @param $waterImg 浮水印圖片 * @param $savepath 儲存路徑 * @param $savename 儲存名字 * @param $positon 浮水印位置 * 1:頂部居左, 2:頂部居右, 3:置中, 4:底部局左, 5:底部居右 * @param $alpha 透明度 --
Time of Update: 2016-07-25
/** * 完整詞的截取 * bbs.it-home.org 編輯整理 * @param $str * @param $start * @param $length * * @return string */ public static function usubstr($str, $start, $length = null) { // 先正常截取一遍. $res = substr($str, $start, $length);
Time of Update: 2016-07-25
$file = "temp.txt"; $fp = fopen($file , 'w'); if(flock($fp , LOCK_EX)){ fwrite($fp , "abc\n"); sleep(10); fwrite($fp , "123\n"); flock($fp , LOCK_UN); } fclose($fp); 複製代碼2) b.php $file = "temp.txt";
Time of Update: 2016-07-25
/* 檢查原始檔案是否存在及獲得原始檔案的資訊 */ $org_info = @getimagesize($img); $img_org = $this->img_resource($img, $org_info[2]); /* 原始圖片以及縮圖的尺寸比例 */ $scale_org = $org_info[0] / $org_info[1]; /* 處理只有縮圖寬和高有一個為0的情況,這時背景和縮圖一樣大 */ if ($thumb_width =
Time of Update: 2016-07-25
本文介紹了php匯出excel儲存格自動換行的實現方法,Spreadsheet Excel Writer可以將資料匯出成Excel檔案,並設定字型、顏色、儲存格大小等格式,需要的朋友參考下。Spreadsheet Excel Writer可以將資料匯出成Excel檔案,並設定字型、顏色、儲存格大小等格式。$workbook = new Spreadsheet_Excel_Writer(); $filename = date('YmdHis').'.xls';//csv $workbook->
Time of Update: 2016-07-25
$filename = "./".$_REQUEST['name']; //具體路徑,只要$filename是所要下載檔案的完整路徑即可if (!is_file($filename)) {//檢測檔案是否存在. die('下載的檔案好像跟TM誰私奔啦!');}$filepath = str_replace('\\', '/', realpath($filename));$filesize = filesize($filepath);$filename = substr(strrchr('/'.$