Time of Update: 2016-07-25
本文介紹下,在php編程中用於判斷圖片格式的方法,這也是最基本的一種方法,通過判斷檔案的副檔名來實現的。有需要的朋友參考下吧。php判斷圖片格式,下面是最簡單的方法:另外,在php中判斷圖片格式,多是在上傳圖片的過程中。此時,可以用:$_FILES['userfile']['type']在檔案上傳之前判斷。另外,php中還有一個getimagesize函數,用於取得映像大小。getimagesize 返回和參數如下。返回一個具有四個單元的數組。索引 0 包含映像寬度的像素值,索引 1
Time of Update: 2016-07-25
/*** PHP Socket POP3類* by bbs.it-home.org*/class SocketPOPClient { var $strMessage = ''; var $intErrorNum = 0; var $bolDebug = false; var $strEmail = ''; var $strPasswd = ''; var $strHost =
Time of Update: 2016-07-25
/****PHP陰曆轉農曆* by bbs.it-home.org*/class Lunar {var $MIN_YEAR = 1891;var $MAX_YEAR = 2100;var $lunarInfo =
Time of Update: 2016-07-25
本文介紹下,用php擷取漢字中首個字母的方法,編碼格式為gb2312,有需要的朋友參考下。php取得漢字中首個字母,代碼:0xB0C4,'b'=>0xB2C0,'c'=>0xB4ED,'d'=>0xB6E9,'e'=>0xB7A1,'f'=>0xB8C0,'g'=>0xB9FD,'h'=>0xBBF6,'j'=>0xBFA5,'k'=>0xC0AB,'l'=>0xC2E7,'m'=>0xC4C2,'n'=>0xC5B5,'o'=>0xC5BD,'p'=>0xC6D9,'q'=>0xC8BA,'r
Time of Update: 2016-07-25
Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]複製代碼如果你用的是 Windows主機,應該在控制台做301轉向設定。編輯精選:php偽靜態 URL REWRITE重寫規則介紹php URL rewrite路徑重寫一例補充
Time of Update: 2016-07-25
Mac 在國外很受歡迎,尤其是在 設計/web開發/IT 人員圈子裡。普通使用者喜歡 Mac 可以理解,畢竟 Mac 設計美觀,簡單好用,沒有病毒。那麼為什麼專業人士也對 Mac 情有獨鐘呢?從個人使用經驗來看我想有下面幾個原因:1、MacOS X 是基於 Unix 的這一點太重要了,尤其是對開發人員,至少對於我來說很重要,這意味著Unix 下一堆好用的工具都可以隨手撿到。如果你是個 windows 開發人員,我想你會在 windows 上裝一套cygwin 環境吧?你不用 flex/yacc,
Time of Update: 2016-07-25
mysql->CREATE DATABASE dbname;//建立資料庫 mysql->CREATE TABLE tablename;//建立表 mysql->SHOW DATABASES;//顯示資料庫資訊,有那些可用的資料庫。 mysql->USE dbname;//選擇資料庫 mysql->SHOW TABLES;//顯示表資訊,有那些可用的表 mysql->DESCRIBE
Time of Update: 2016-07-25
本文介紹下,一個用於email郵件發送的類,可以使用smtp與mail函數二種方式發送郵件,有需要的朋友參考下。php實現的郵件發送類,二種方式:smtp方式與mail函數方式。代碼:SendFromMail == ''){ $this->SendFromMail = $this->smtp_user; } } public function Send($mail_to = '', $subject = '',
Time of Update: 2016-07-25
分析下php中三個等號===與二個等號==,在比較運算上的區別,有需要的朋友參考下。近日,想研究下php中”===”和”==”的具體區別。其實”===”也是作比較用的,只是比較時要求更嚴格。會要求比較兩邊類型也是一樣的;如:$a=8時;if($a==8.0)或者if($a==8) 都是返回TRUE的;但if($a===8.0) 返回的false,
Time of Update: 2016-07-25
/*** JpGraph類產生柱狀圖* by bbs.it-home.org*/$datay=array(); //縱座標資料 $datax=array(); //橫座標資料 foreach ($usernums as $key => $value){ $datay[] = $value; $datax[] = $userids[$key]; } require_once (‘jpgraph-3.0.7/jpgraph/jpgraph.php'); require_once
Time of Update: 2016-07-25
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`,
Time of Update: 2016-07-25
/*** 計算剩餘時間* by bbs.it-home.org*/public function gettime($time_s,$time_n){$time_s = strtotime($time_s);$time_n = strtotime($time_n);$strtime = '';$time = $time_n-$time_s;if($time >= 86400){return $strtime = date('Y-m-d H:i:s',$time_s);}if($time >= 36
Time of Update: 2016-07-25
$a = 'Original'; $my_array = array("a" => "Cat","b" => "Dog", "c" => "Horse"); extract($my_array); echo "\$a = $a; \$b = $b; \$c = $c"; ?>複製代碼輸出:$a = Cat; $b = Dog; $c = Horse例子 2 使用全部參數: $a = 'Original'; $my_array = array("a" => "Cat","b" => "Dog",
Time of Update: 2016-07-25
$con = mysql_connect("localhost","peter","abc123");if (!$con) { die('Could not connect: ' . mysql_error()); }// some code?>複製代碼關閉串連指令碼一結束,就會關閉串連。如需提前關閉串連,請使用 mysql_close() 函數。 $con = mysql_connect("localhost","peter","abc123");if (!$con) {
Time of Update: 2016-07-25
for($i=0; $i echo $i.''; sleep(2); } ?> 複製代碼運行結果:等所有指令碼全部運行完成後,才輸出,因為資料未滿一個buffer的大小。例2,output_buffering=4096,輸出較少的資料(少於一個buffer),關閉output_buffering,修改php.ini的output_buffering=0 for($i=0; $i echo $i.str_repeat(" ",500).''; // 當接受到的256(
Time of Update: 2016-07-25
/*** php防止sql注入* by bbs.it-home.org*/class sqlsafe { private $getfilter = "'|(and|or)\\b.+?(>| private $postfilter = "\\b(and|or)\\b.{1,6}?(=|>| private $cookiefilter = "\\b(and|or)\\b.{1,6}?(=|>| /** * 建構函式 */ public function __construct() {
Time of Update: 2016-07-25
$name = 'yutuo';// 單引號字串echo 'my name is $name';// 單引號字串echo "my name is $name";echo "my name is {$name}";// here文檔字串echo my name is $namemy name is {$name}end; 複製代碼其結果為(輸出沒有任何換行,為了容易理解,在結果裡換行了):my name is $namemy name is yutuomy name is yutuomy
Time of Update: 2016-07-25
$fname = $_FILES['MyFile']['name']; $do = copy($_FILES['MyFile']['tmp_name'],$fname); if ($do){ echo"匯入資料成功"; }else{ echo ""; } ?> error_reporting(0);//匯入CSV格式的檔案 $connect=mysql_connect("localhost","a0530093319","123456") or die("could not connect
Time of Update: 2016-07-25
class session_handler { protected $maxlifetime = null; protected $dbHandle = null; public $config = null; public static function init($args) { return new self($args); } public function __construct($args) { $this->config = $args;
Time of Update: 2016-07-25
//漢字轉換為16進位編碼function hexencode($s) { return preg_replace('/(.)/es',"str_pad(dechex(ord('\\1')),2,'0',str_pad_left)",$s); }//16進位編碼轉換為漢字function hexdecode($s) { return preg_replace('/(\w{2})/e',"chr(hexdec('\\1'))",$s);}echo