久艹网,亚洲一日韩欧美中文字幕2019,国产欧美日韩精品专区黑人,一区二区三区久久99

中山php|最優(yōu)網(wǎng)絡(luò)中山做網(wǎng)站 中山php建站

最優(yōu)良人

2011/10/11 at 14:08

PHP預(yù)定義常量(內(nèi)部常量)DIRECTORY_SEPARATOR,PHP_VERSION,PHP_OS

DIRECTORY_SEPARATOR
是PHP內(nèi)部常量,表示路徑分隔符 在win里為\ ,在linux 里為/

PHP_VERSION
這個(gè)內(nèi)建常量是 PHP 程序的版本,如 '3.0.8-dev'。

PHP_OS
這個(gè)內(nèi)建常量指執(zhí)行 PHP 解析器的操作系統(tǒng)名稱,如 'Linux'。

預(yù)定義常量表

內(nèi)核預(yù)定義常量
這些常量在 PHP 的內(nèi)核中定義。它包含 PHP、Zend 引擎和 SAPI 模塊。

PHP_VERSION (string)
PHP_OS (string)
PHP_SAPI (string)
自 PHP 4.2.0 起可用。參見 php_sapi_name()。
PHP_EOL (string)
自 PHP 4.3.10 和 PHP 5.0.2 起可用
PHP_INT_MAX (integer)
自 PHP 4.4.0 和 PHP 5.0.5 起可用
PHP_INT_SIZE (integer)
自 PHP 4.4.0 和 PHP 5.0.5 起可用
DEFAULT_INCLUDE_PATH (string)
PEAR_INSTALL_DIR (string)
PEAR_EXTENSION_DIR (string)
PHP_EXTENSION_DIR (string)
PHP_PREFIX (string)
自 PHP 4.3.0 起可用
PHP_BINDIR (string)
PHP_LIBDIR (string)
PHP_DATADIR (string)
PHP_SYSCONFDIR (string)
PHP_LOCALSTATEDIR (string)
PHP_CONFIG_FILE_PATH (string)
PHP_CONFIG_FILE_SCAN_DIR (string)
PHP_SHLIB_SUFFIX (string)
自 PHP 4.3.0 起可用
PHP_OUTPUT_HANDLER_START (integer)
PHP_OUTPUT_HANDLER_CONT (integer)
PHP_OUTPUT_HANDLER_END (integer)
E_ERROR (integer)
E_WARNING (integer)
E_PARSE (integer)
E_NOTICE (integer)
E_CORE_ERROR (integer)
E_CORE_WARNING (integer)
E_COMPILE_ERROR (integer)
E_COMPILE_WARNING (integer)
E_USER_ERROR (integer)
E_USER_WARNING (integer)
E_USER_NOTICE (integer)
E_ALL (integer)
E_STRICT (integer)
從 PHP 5.0.0 起有效
__COMPILER_HALT_OFFSET__ (integer)
自 PHP 5.1.0 起有效
 

標(biāo)準(zhǔn)預(yù)定義常量
這些常量是 PHP 默認(rèn)定義的。

EXTR_OVERWRITE (integer)
EXTR_SKIP (integer)
EXTR_PREFIX_SAME (integer)
EXTR_PREFIX_ALL (integer)
EXTR_PREFIX_INVALID (integer)
EXTR_PREFIX_IF_EXISTS (integer)
EXTR_IF_EXISTS (integer)
SORT_ASC (integer)
SORT_DESC (integer)
SORT_REGULAR (integer)
SORT_NUMERIC (integer)
SORT_STRING (integer)
CASE_LOWER (integer)
CASE_UPPER (integer)
COUNT_NORMAL (integer)
COUNT_RECURSIVE (integer)
ASSERT_ACTIVE (integer)
ASSERT_CALLBACK (integer)
ASSERT_BAIL (integer)
ASSERT_WARNING (integer)
ASSERT_QUIET_EVAL (integer)
CONNECTION_ABORTED (integer)
CONNECTION_NORMAL (integer)
CONNECTION_TIMEOUT (integer)
INI_USER (integer)
INI_PERDIR (integer)
INI_SYSTEM (integer)
INI_ALL (integer)
M_E (float)
M_LOG2E (float)
M_LOG10E (float)
M_LN2 (float)
M_LN10 (float)
M_PI (float)
M_PI_2 (float)
M_PI_4 (float)
M_1_PI (float)
M_2_PI (float)
M_2_SQRTPI (float)
M_SQRT2 (float)
M_SQRT1_2 (float)
CRYPT_SALT_LENGTH (integer)
CRYPT_STD_DES (integer)
CRYPT_EXT_DES (integer)
CRYPT_MD5 (integer)
CRYPT_BLOWFISH (integer)
DIRECTORY_SEPARATOR (string)
SEEK_SET (integer)
SEEK_CUR (integer)
SEEK_END (integer)
LOCK_SH (integer)
LOCK_EX (integer)
LOCK_UN (integer)
LOCK_NB (integer)
HTML_SPECIALCHARS (integer)
HTML_ENTITIES (integer)
ENT_COMPAT (integer)
ENT_QUOTES (integer)
ENT_NOQUOTES (integer)
INFO_GENERAL (integer)
INFO_CREDITS (integer)
INFO_CONFIGURATION (integer)
INFO_MODULES (integer)
INFO_ENVIRONMENT (integer)
INFO_VARIABLES (integer)
INFO_LICENSE (integer)
INFO_ALL (integer)
CREDITS_GROUP (integer)
CREDITS_GENERAL (integer)
CREDITS_SAPI (integer)
CREDITS_MODULES (integer)
CREDITS_DOCS (integer)
CREDITS_FULLPAGE (integer)
CREDITS_QA (integer)
CREDITS_ALL (integer)
STR_PAD_LEFT (integer)
STR_PAD_RIGHT (integer)
STR_PAD_BOTH (integer)
PATHINFO_DIRNAME (integer)
PATHINFO_BASENAME (integer)
PATHINFO_EXTENSION (integer)
PATH_SEPARATOR (string)
CHAR_MAX (integer)
LC_CTYPE (integer)
LC_NUMERIC (integer)
LC_TIME (integer)
LC_COLLATE (integer)
LC_MONETARY (integer)
LC_ALL (integer)
LC_MESSAGES (integer)
ABDAY_1 (integer)
ABDAY_2 (integer)
ABDAY_3 (integer)
ABDAY_4 (integer)
ABDAY_5 (integer)
ABDAY_6 (integer)
ABDAY_7 (integer)
DAY_1 (integer)
DAY_2 (integer)
DAY_3 (integer)
DAY_4 (integer)
DAY_5 (integer)
DAY_6 (integer)
DAY_7 (integer)
ABMON_1 (integer)
ABMON_2 (integer)
ABMON_3 (integer)
ABMON_4 (integer)
ABMON_5 (integer)
ABMON_6 (integer)
ABMON_7 (integer)
ABMON_8 (integer)
ABMON_9 (integer)
ABMON_10 (integer)
ABMON_11 (integer)
ABMON_12 (integer)
MON_1 (integer)
MON_2 (integer)
MON_3 (integer)
MON_4 (integer)
MON_5 (integer)
MON_6 (integer)
MON_7 (integer)
MON_8 (integer)
MON_9 (integer)
MON_10 (integer)
MON_11 (integer)
MON_12 (integer)
AM_STR (integer)
PM_STR (integer)
D_T_FMT (integer)
D_FMT (integer)
T_FMT (integer)
T_FMT_AMPM (integer)
ERA (integer)
ERA_YEAR (integer)
ERA_D_T_FMT (integer)
ERA_D_FMT (integer)
ERA_T_FMT (integer)
ALT_DIGITS (integer)
INT_CURR_SYMBOL (integer)
CURRENCY_SYMBOL (integer)
CRNCYSTR (integer)
MON_DECIMAL_POINT (integer)
MON_THOUSANDS_SEP (integer)
MON_GROUPING (integer)
POSITIVE_SIGN (integer)
NEGATIVE_SIGN (integer)
INT_FRAC_DIGITS (integer)
FRAC_DIGITS (integer)
P_CS_PRECEDES (integer)
P_SEP_BY_SPACE (integer)
N_CS_PRECEDES (integer)
N_SEP_BY_SPACE (integer)
P_SIGN_POSN (integer)
N_SIGN_POSN (integer)
DECIMAL_POINT (integer)
RADIXCHAR (integer)
THOUSANDS_SEP (integer)
THOUSEP (integer)
GROUPING (integer)
YESEXPR (integer)
NOEXPR (integer)
YESSTR (integer)
NOSTR (integer)
CODESET (integer)
LOG_EMERG (integer)
LOG_ALERT (integer)
LOG_CRIT (integer)
LOG_ERR (integer)
LOG_WARNING (integer)
LOG_NOTICE (integer)
LOG_INFO (integer)
LOG_DEBUG (integer)
LOG_KERN (integer)
LOG_USER (integer)
LOG_MAIL (integer)
LOG_DAEMON (integer)
LOG_AUTH (integer)
LOG_SYSLOG (integer)
LOG_LPR (integer)
LOG_NEWS (integer)
LOG_UUCP (integer)
LOG_CRON (integer)
LOG_AUTHPRIV (integer)
LOG_LOCAL0 (integer)
LOG_LOCAL1 (integer)
LOG_LOCAL2 (integer)
LOG_LOCAL3 (integer)
LOG_LOCAL4 (integer)
LOG_LOCAL5 (integer)
LOG_LOCAL6 (integer)
LOG_LOCAL7 (integer)
LOG_PID (integer)
LOG_CONS (integer)
LOG_ODELAY (integer)
LOG_NDELAY (integer)
LOG_NOWAIT (integer)
LOG_PERROR (integer)

標(biāo)簽:
2011/09/29 at 16:29

php生成excel或者word文檔最簡(jiǎn)單的方法

以下代碼實(shí)現(xiàn)簡(jiǎn)單輸出表格或者word文檔,如生成一個(gè)兩列的excel文檔,改動(dòng)相應(yīng)文件頭為

header("Content-type:application/vnd.msword");
header("Content-Disposition:filename=test.doc");

就可以輸出.doc .xls等文件格式了

header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "test1\t";
echo "test2\t\n"; //兩列之后換行
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";

附一個(gè)文件格式對(duì)應(yīng)的數(shù)組

$mime_types = array(
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'pict' => 'image/x-pict',
'pic' => 'image/x-pict',
'pct' => 'image/x-pict',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'psd' => 'image/x-photoshop',

'swf' => 'application/x-shockwave-flash',
'js' => 'application/x-javascript',
'pdf' => 'application/pdf',
'ps' => 'application/postscript',
'eps' => 'application/postscript',
'ai' => 'application/postscript',
'wmf' => 'application/x-msmetafile',

'css' => 'text/css',
'htm' => 'text/html',
'html' => 'text/html',
'txt' => 'text/plain',
'xml' => 'text/xml',
'wml' => 'text/wml',
'wbmp' => 'image/vnd.wap.wbmp',

'mid' => 'audio/midi',
'wav' => 'audio/wav',
'mp3' => 'audio/mpeg',
'mp2' => 'audio/mpeg',

'avi' => 'video/x-msvideo',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',

'lha' => 'application/x-lha',
'lzh' => 'application/x-lha',
'z' => 'application/x-compress',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'tgz' => 'application/x-gzip',
'tar' => 'application/x-tar',
'bz2' => 'application/bzip2',
'zip' => 'application/zip',
'arj' => 'application/x-arj',
'rar' => 'application/x-rar-compressed',

'hqx' => 'application/mac-binhex40',
'sit' => 'application/x-stuffit',
'bin' => 'application/x-macbinary',

'uu' => 'text/x-uuencode',
'uue' => 'text/x-uuencode',

'latex'=> 'application/x-latex',
'ltx' => 'application/x-latex',
'tcl' => 'application/x-tcl',

'pgp' => 'application/pgp',
'asc' => 'application/pgp',
'exe' => 'application/x-msdownload',
'doc' => 'application/msword',
'rtf' => 'application/rtf',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
'mdb' => 'application/x-msaccess',
'wri' => 'application/x-mswrite',
);

標(biāo)簽:, ,
2011/09/29 at 16:25

php獲取訪問(wèn)者操作系統(tǒng)

function osinfo() {
$os="";
$Agent = $GLOBALS["HTTP_USER_AGENT"];
if (eregi('win',$Agent) && strpos($Agent, '95')) {
$os="Windows 95";
}
elseif (eregi('win 9x',$Agent) && strpos($Agent, '4.90')) {
$os="Windows ME";
}
elseif (eregi('win',$Agent) && ereg('98',$Agent)) {
$os="Windows 98";
}
elseif (eregi('win',$Agent) && eregi('nt 5\.0',$Agent)) {
$os="Windows 2000";
}
elseif (eregi('win',$Agent) && eregi('nt',$Agent)) {
$os="Windows NT";
}
elseif (eregi('win',$Agent) && eregi('nt 5\.1',$Agent)) {
$os="Windows XP";
}
elseif (eregi('win',$Agent) && ereg('32',$Agent)) {
$os="Windows 32";
}
elseif (eregi('linux',$Agent)) {
$os="Linux\";
}
elseif (eregi('unix',$Agent)) {
$os="Unix";
}
elseif (eregi('sun',$Agent) && eregi('os',$Agent)) {
$os="SunOS";
}
elseif (eregi('ibm',$Agent) && eregi('os',$Agent)) {
$os="IBM OS/2";
}
elseif (eregi('Mac',$Agent) && eregi('PC',$Agent)) {
$os="Macintosh";
}
elseif (eregi('PowerPC',$Agent)) {
$os="PowerPC";
}
elseif (eregi('AIX',$Agent)) {
$os="AIX";
}
elseif (eregi('HPUX',$Agent)) {
$os="HPUX";
}
elseif (eregi('NetBSD',$Agent)) {
$os="NetBSD";
}
elseif (eregi('BSD',$Agent)) {
$os="BSD";
}
elseif (ereg('OSF1',$Agent)) {
$os="OSF1";
}
elseif (ereg('IRIX',$Agent)) {
$os="IRIX";
}
elseif (eregi('FreeBSD',$Agent)) {
$os="FreeBSD\";
}
if ($os=='') $os = "Unknown";
return $os;
}

標(biāo)簽:
comments Comments (258)    -
2011/09/29 at 16:24

php獲取訪問(wèn)者瀏覽器

以下函數(shù)實(shí)現(xiàn)返回瀏覽者所使用的瀏覽器

function browse_infor() {
$browser="";$browserver="";
$Browsers =array("Lynx","MOSAIC","AOL","Opera","JAVA","MacWeb","WebExplorer","OmniWeb");
$Agent = $GLOBALS["HTTP_USER_AGENT"];
for ($i=0; $i<=7; $i++) {
if (strpos($Agent,$Browsers[$i])) {
$browser = $Browsers[$i];
$browserver ="";
}
}
if (ereg("Mozilla",$Agent) && !ereg("MSIE",$Agent)) {
$temp =explode("(", $Agent); $Part=$temp[0];
$temp =explode("/", $Part); $browserver=$temp[1];
$temp =explode(" ",$browserver); $browserver=$temp[0];
$browserver =preg_replace("/([\d\.]+)/","\\1",$browserver);
$browserver = " $browserver";
$browser = "Netscape Navigator";
}
if (ereg("Mozilla",$Agent) && ereg("Opera",$Agent)) {
$temp =explode("(", $Agent); $Part=$temp[1];
$temp =explode(")", $Part); $browserver=$temp[1];
$temp =explode(" ",$browserver);$browserver=$temp[2];
$browserver =preg_replace("/([\d\.]+)/","\\1",$browserver);
$browserver = " $browserver";
$browser = "Opera";
}
if (ereg("Mozilla",$Agent) && ereg("MSIE",$Agent)) {
$temp = explode("(", $Agent); $Part=$temp[1];
$temp = explode(";",$Part); $Part=$temp[1];
$temp = explode(" ",$Part);$browserver=$temp[2];
$browserver =preg_replace("/([\d\.]+)/","\\1",$browserver);
$browserver = " $browserver";
$browser = "Internet Explorer";
}
if ($browser!="") {
$browseinfo = "$browser$browserver";
}else {
$browseinfo = "Unknown";
}
return $browseinfo;
}

標(biāo)簽:
comments Comments (5)    -
2011/09/29 at 16:20

在IIS中運(yùn)行php,讓IIS支持php配置方法

1、將 PHP 安裝為 ISAPI 模式:
在“控制面板”的“管理工具”中選擇“Internet 服務(wù)管理器”,打開 IIS 后停止服務(wù),然后在左側(cè)“默認(rèn)Web站點(diǎn)”上單擊右鍵選擇“屬性”,在打開的“默認(rèn) Web 站點(diǎn)屬性”窗口的“ISAPI 篩選器”標(biāo)簽里找到并點(diǎn)擊“添加”按鈕,在彈出的“篩選器屬性”窗口中的“篩選器名稱”欄中輸入:PHP,再將可執(zhí)行文件指向 php4isapi.dll 所在路徑,如:C:\PHP\sapi\php4isapi.dll。

2、打開“默認(rèn) Web 站點(diǎn)屬性”窗口的“主目錄”標(biāo)簽,找到并點(diǎn)擊“配置”按鈕,在彈出的“應(yīng)用程序配置”窗口中找到并點(diǎn)擊“添加”按鈕,在彈出的窗口中新增一個(gè)擴(kuò)展名映射,擴(kuò)展名為 .php,單擊“瀏覽”將可執(zhí)行文件指向 php4isapi.dll 所在路徑,如:C:\PHP\sapi\php4isapi.dll,然后一路確定即可。如果還想支持諸如 .php3,.phtml 等擴(kuò)展名的 PHP 文件,可以重復(fù)“添加”步驟。

3、再打開“默認(rèn) Web 站點(diǎn)屬性”窗口的“的“文檔”標(biāo)簽,找到并點(diǎn)擊“添加”按鈕,向默認(rèn)的 Web 站點(diǎn)啟動(dòng)文檔列表中添加 index.php 項(xiàng)。您可以將 index.php 升到最高優(yōu)先級(jí),這樣,訪問(wèn)站點(diǎn)時(shí)就會(huì)首先自動(dòng)尋找并打開 index.php 文檔。

4、確定 Web 目錄的應(yīng)用程序設(shè)置和執(zhí)行許可中選擇為純腳本,然后關(guān)閉 Internet 信息服務(wù)管理器,在命令提示符中執(zhí)行如下命令:

net stop w3svc
net stop iisadmin
net start w3svc

5、打開瀏覽器,輸入:http://localhost/,看到成功頁(yè)面后,在 IIS 根目錄下新建一個(gè) phpinfo.php,內(nèi)容如下:

<?php
phpinfo();
?>

6、打開瀏覽器,輸入:http://localhost/phpinfo.php,將顯示當(dāng)前服務(wù)器所支持 PHP 的全部信息,可以看到 Server API的模式為:ISAPI。

標(biāo)簽:,
comments Comments (270)    -
2011/09/23 at 17:46

JS獲取屏幕、瀏覽器、網(wǎng)頁(yè)的寬度,高度

網(wǎng)頁(yè)可見區(qū)域?qū)挘篸ocument.body.clientWidth
網(wǎng)頁(yè)可見區(qū)域高:document.body.clientHeight
網(wǎng)頁(yè)可見區(qū)域?qū)挘篸ocument.body.offsetWidth (包括邊線的寬)
網(wǎng)頁(yè)可見區(qū)域高:document.body.offsetHeight (包括邊線的寬)
網(wǎng)頁(yè)正文全文寬:document.body.scrollWidth
網(wǎng)頁(yè)正文全文高:document.body.scrollHeight
網(wǎng)頁(yè)被卷走的高:document.body.scrollTop
網(wǎng)頁(yè)被卷走的左:document.body.scrollLeft
網(wǎng)頁(yè)正文部分上:window.screenTop
網(wǎng)頁(yè)正文部分左:window.screenLeft
屏幕分辨率的高:window.screen.height
屏幕分辨率的寬:window.screen.width
屏幕可用勞動(dòng)區(qū)高度:window.screen.availHeight
屏幕可用勞動(dòng)區(qū)寬度:window.screen.availWidth

HTML正確定位:scrollLeft,scrollWidth,clientWidth,offsetWidth

scrollHeight: 獲取東西的轉(zhuǎn)動(dòng)高度。

scrollLeft:設(shè)置或獲取位于東西左界限和窗口中目前可見內(nèi)容的最左端之間的間隔

scrollTop:設(shè)置或獲取位于東西最頂端和窗口中可見內(nèi)容的最頂端之間的間隔

scrollWidth:獲取東西的轉(zhuǎn)動(dòng)寬度

offsetHeight:獲取東西盡對(duì)付版面或由父坐標(biāo) offsetParent 屬指定

的父坐標(biāo)的高度

offsetLeft:獲取東西盡對(duì)付版面或由 offsetParent 屬指定的父坐標(biāo)的計(jì)算左側(cè)地位

offsetTop:獲取東西盡對(duì)付版面或由 offsetTop 屬指定的父坐標(biāo)的計(jì)算頂端地位

event.clientX 盡對(duì)文檔的程度座標(biāo)

event.clientY 盡對(duì)文檔的筆挺座標(biāo)

event.offsetX 盡對(duì)容器的程度坐標(biāo)

event.offsetY 盡對(duì)容器的筆挺坐標(biāo)

document.documentElement.scrollTop 筆挺偏向轉(zhuǎn)動(dòng)的值

event.clientX+document.documentElement.scrollTop 盡對(duì)文檔的程度座標(biāo)+筆挺偏向轉(zhuǎn)動(dòng)的量

IE,F(xiàn)ireFox 差別如下:

IE6.0、FF1.06+:

clientWidth = width + padding

clientHeight = height + padding

offsetWidth = width + padding + border

offsetHeight = height + padding + border

IE5.0/5.5:
clientWidth = width - border

clientHeight = height - border

offsetWidth = width

offsetHeight = height

標(biāo)簽:
comments Comments (18)    -
2011/09/21 at 14:50

mysql所有數(shù)據(jù)庫(kù)引擎用法MyISAM、InnoDB、MERGE、MEMORY(HEAP)、BDB(BerkeleyDB)、EXAMPLE、FEDERATED、ARCHIVE、CSV、BLACKHOLE

MySQL有多種存儲(chǔ)引擎,每種存儲(chǔ)引擎有各自的優(yōu)缺點(diǎn),大家可以擇優(yōu)選擇使用:

MyISAM、InnoDB、MERGE、MEMORY(HEAP)、BDB(BerkeleyDB)、EXAMPLE、FEDERATED、ARCHIVE、CSV、BLACKHOLE。

MySQL支持?jǐn)?shù)個(gè)存儲(chǔ)引擎作為對(duì)不同表的類型的處理器。MySQL存儲(chǔ)引擎包括處理事務(wù)安全表的引擎和處理非事務(wù)安全表的引擎:

· MyISAM管理非事務(wù)表。它提供高速存儲(chǔ)和檢索,以及全文搜索能力。MyISAM在所有MySQL配置里被支持,它是默認(rèn)的存儲(chǔ)引擎,除非你配置MySQL默認(rèn)使用另外一個(gè)引擎。

· MEMORY存儲(chǔ)引擎提供“內(nèi)存中”表。MERGE存儲(chǔ)引擎允許集合將被處理同樣的MyISAM表作為一個(gè)單獨(dú)的表。就像MyISAM一樣,MEMORY和MERGE存儲(chǔ)引擎處理非事務(wù)表,這兩個(gè)引擎也都被默認(rèn)包含在MySQL中。

注釋:MEMORY存儲(chǔ)引擎正式地被確定為HEAP引擎。

· InnoDB和BDB存儲(chǔ)引擎提供事務(wù)安全表。BDB被包含在為支持它的操作系統(tǒng)發(fā)布的MySQL-Max二進(jìn)制分發(fā)版里。InnoDB也默認(rèn)被包括在所 有MySQL 5.1二進(jìn)制分發(fā)版里,你可以按照喜好通過(guò)配置MySQL來(lái)允許或禁止任一引擎。
· EXAMPLE存儲(chǔ)引擎是一個(gè)“存根”引擎,它不做什么。你可以用這個(gè)引擎創(chuàng)建表,但沒(méi)有數(shù)據(jù)被存儲(chǔ)于其中或從其中檢索。這個(gè)引擎的目的是服務(wù),在 MySQL源代碼中的一個(gè)例子,它演示說(shuō)明如何開始編寫新存儲(chǔ)引擎。同樣,它的主要興趣是對(duì)開發(fā)者。

· NDB Cluster是被MySQL Cluster用來(lái)實(shí)現(xiàn)分割到多臺(tái)計(jì)算機(jī)上的表的存儲(chǔ)引擎。它在MySQL-Max 5.1二進(jìn)制分發(fā)版里提供。這個(gè)存儲(chǔ)引擎當(dāng)前只被Linux, Solaris, 和Mac OS X 支持。在未來(lái)的MySQL分發(fā)版中,我們想要添加其它平臺(tái)對(duì)這個(gè)引擎的支持,包括Windows。

· ARCHIVE存儲(chǔ)引擎被用來(lái)無(wú)索引地,非常小地覆蓋存儲(chǔ)的大量數(shù)據(jù)。

· CSV存儲(chǔ)引擎把數(shù)據(jù)以逗號(hào)分隔的格式存儲(chǔ)在文本文件中。

· BLACKHOLE存儲(chǔ)引擎接受但不存儲(chǔ)數(shù)據(jù),并且檢索總是返回一個(gè)空集。

· FEDERATED存儲(chǔ)引擎把數(shù)據(jù)存在遠(yuǎn)程數(shù)據(jù)庫(kù)中。在MySQL 5.1中,它只和MySQL一起工作,使用MySQL C Client API。在未來(lái)的分發(fā)版中,我們想要讓它使用其它驅(qū)動(dòng)器或客戶端連接方法連接到另外的數(shù)據(jù)源。

當(dāng)你創(chuàng)建一個(gè)新表的時(shí)候,你可以通過(guò)添加一個(gè)ENGINE 或TYPE 選項(xiàng)到CREATE TABLE語(yǔ)句來(lái)告訴MySQL你要?jiǎng)?chuàng)建什么類型的表:

CREATE TABLE t (i INT) ENGINE = INNODB;

CREATE TABLE t (i INT) TYPE = MEMORY;

雖然TYPE仍然在MySQL 5.1中被支持,現(xiàn)在ENGINE是首選的術(shù)語(yǔ)。

如何選擇最適合你的存儲(chǔ)引擎呢?

下述存儲(chǔ)引擎是最常用的:

· MyISAM:默認(rèn)的MySQL插件式存儲(chǔ)引擎,它是在Web、數(shù)據(jù)倉(cāng)儲(chǔ)和其他應(yīng)用環(huán)境下最常使用的存儲(chǔ)引擎之一。注意,通過(guò)更改STORAGE_ENGINE配置變量,能夠方便地更改MySQL服務(wù)器的默認(rèn)存儲(chǔ)引擎。

· InnoDB:用于事務(wù)處理應(yīng)用程序,具有眾多特性,包括ACID事務(wù)支持。

· BDB:可替代InnoDB的事務(wù)引擎,支持COMMIT、ROLLBACK和其他事務(wù)特性。

· Memory:將所有數(shù)據(jù)保存在RAM中,在需要快速查找引用和其他類似數(shù)據(jù)的環(huán)境下,可提供極快的訪問(wèn)。

· Merge:允許MySQL DBA或開發(fā)人員將一系列等同的MyISAM表以邏輯方式組合在一起,并作為1個(gè)對(duì)象引用它們。對(duì)于諸如數(shù)據(jù)倉(cāng)儲(chǔ)等VLDB環(huán)境十分適合。

· Archive:為大量很少引用的歷史、歸檔、或安全審計(jì)信息的存儲(chǔ)和檢索提供了完美的解決方案。

· Federated:能夠?qū)⒍鄠€(gè)分離的MySQL服務(wù)器鏈接起來(lái),從多個(gè)物理服務(wù)器創(chuàng)建一個(gè)邏輯數(shù)據(jù)庫(kù)。十分適合于分布式環(huán)境或數(shù)據(jù)集市環(huán)境。

· Cluster/NDB:MySQL的簇式數(shù)據(jù)庫(kù)引擎,尤其適合于具有高性能查找要求的應(yīng)用程序,這類查找需求還要求具有最高的正常工作時(shí)間和可用性。

· Other:其他存儲(chǔ)引擎包括CSV(引用由逗號(hào)隔開的用作數(shù)據(jù)庫(kù)表的文件),Blackhole(用于臨時(shí)禁止對(duì)數(shù)據(jù)庫(kù)的應(yīng)用程序輸入),以及Example引擎(可為快速創(chuàng)建定制的插件式存儲(chǔ)引擎提供幫助)。

記住,對(duì)于整個(gè)服務(wù)器或方案,你并不一定要使用相同的存儲(chǔ)引擎,你可以為方案中的每個(gè)表使用不同的存儲(chǔ)引擎,這點(diǎn)很重要。

mysql> show engines;
+——————–+————+———————————————–———————-—————————–+
| Engine | Support | Comment |
+——————–+————+———————————————————–———————-——————+
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys |
| BerkeleyDB | NO | Supports transactions and page-level locking |
| BLACKHOLE | NO | /dev/null storage engine (anything you write to it disappears) |
| EXAMPLE | NO | Example storage engine |
| ARCHIVE | NO | Archive storage engine |
| CSV | NO | CSV storage engine |
| ndbcluster | NO | Clustered, fault-tolerant, memory-based tables |
| FEDERATED | NO | Federated MySQL storage engine |
| MRG_MYISAM | YES | Collection of identical MyISAM tables |
| ISAM | NO | Obsolete storage engine |
+————+———+—————————————————————————————-+

標(biāo)簽:
comments Comments (94)    -
2011/09/21 at 14:47

mysql數(shù)據(jù)庫(kù)引擎HEAP(MEMORY)的使用,內(nèi)存表,臨時(shí)表的用法

HEAP表是訪問(wèn)數(shù)據(jù)速度最快的MySQL表,他使用保存在內(nèi)存中的散列索引。但如果MySQL或者服務(wù)器重新啟動(dòng),表中數(shù)據(jù)將會(huì)丟失.
用法:如論壇的在線人數(shù)統(tǒng)計(jì),這種表的數(shù)據(jù)應(yīng)該是無(wú)關(guān)緊要的,就幾個(gè)簡(jiǎn)單的字段,數(shù)據(jù)也不多,記錄數(shù)怎么也不會(huì)超過(guò)1000吧,但是操作是最頻繁的(基本用戶的每次動(dòng)作都要更新這個(gè)表).

如何創(chuàng)建內(nèi)存表?
創(chuàng)建內(nèi)存表非常的簡(jiǎn)單,只需注明 ENGINE= MEMORY 即可:
CREATE TABLE `tablename` ( `columnName` varchar(256) NOT NUL) ENGINE=MEMORY DEFAULT CHARSET=latin1 MAX_ROWS=100000000;

注意:
當(dāng)內(nèi)存表中的數(shù)據(jù)大于max_heap_table_size設(shè)定的容量大小時(shí),mysql會(huì)轉(zhuǎn)換超出的數(shù)據(jù)存儲(chǔ)到磁盤上,因此這是性能就大打折扣了,所 以我們還需要根據(jù)我們的實(shí)際情況調(diào)整max_heap_table_size,例如在.cnf文件中[mysqld]的下面加入:
max_heap_table_size = 2048M
另外在建表語(yǔ)句中還可以通過(guò)MAX_ROWS來(lái)控制表的記錄數(shù)。

內(nèi)存表使用哈希散列索引把數(shù)據(jù)保存在內(nèi)存中,因此具有極快的速度,適合緩存中小型數(shù)據(jù)庫(kù),但是使用上受到一些限制。

1、heap對(duì)所有用戶的連接是可見的,這使得它非常適合做緩存。

2、僅適合使用的場(chǎng)合。heap不允許使用xxxTEXT和xxxBLOB數(shù)據(jù)類型;只允許使用=和&lt;=&gt;操作符來(lái)搜索記錄 (不允許&lt;、&gt;、&lt;=或&gt;=);不支持auto_increment;只允許對(duì)非空數(shù)據(jù)列進(jìn)行 索引(not null)。
注:操作符 “&lt;=&gt;” 說(shuō)明:NULL-safe equal.這個(gè)操作符和“=”操作符執(zhí)行相同的比較操作,不過(guò)在兩個(gè)操作碼均為NULL時(shí),其所得值為1而不為NULL,而當(dāng)一個(gè)操作碼為NULL時(shí),其所得值為0而不為NULL。

3、一旦服務(wù)器重啟,所有heap表數(shù)據(jù)丟失,但是heap表結(jié)構(gòu)仍然存在,因?yàn)閔eap表結(jié)構(gòu)是存放在實(shí)際數(shù)據(jù)庫(kù)路徑下的,不會(huì)自動(dòng)刪除。重啟之后,heap將被清空,這時(shí)候?qū)eap的查詢結(jié)果都是空的。

4、如果heap是復(fù)制的某數(shù)據(jù)表,則復(fù)制之后所有主鍵、索引、自增等格式將不復(fù)存在,需要重新添加主鍵和索引,如果需要的話。

5、對(duì)于重啟造成的數(shù)據(jù)丟失,有以下的解決辦法:
a、在任何查詢之前,執(zhí)行一次簡(jiǎn)單的查詢,判斷heap表是否存在數(shù)據(jù),如果不存在,則把數(shù)據(jù)重新寫入,或者DROP表重新復(fù)制某張表。這需要多做一次查詢。不過(guò)可以寫成include文件,在需要用該heap表的頁(yè)面隨時(shí)調(diào)用,比較方便。
b、對(duì)于需要該heap表的頁(yè)面,在該頁(yè)面第一次且僅在第一次查詢?cè)摫頃r(shí),對(duì)數(shù)據(jù)集結(jié)果進(jìn)行判斷,如果結(jié)果為空,則需要重新寫入數(shù)據(jù)。這樣可以節(jié)省一次查詢。
c、更好的辦法是在mysql每次重新啟動(dòng)時(shí)自動(dòng)寫入數(shù)據(jù)到heap,但是需要配置服務(wù)器,過(guò)程比較復(fù)雜,通用性受到限制。

6、一些預(yù)期可能用到的sql語(yǔ)句

//如果表存在,則刪除
DROP TABLE IF EXISTS `abc`;
//復(fù)制整張表xyz為heap表abc(包含所有數(shù)據(jù))
CREATE TABLE `abc` type=heap select * from `xyz`;
//添加主鍵id
ALTER TABLE `abc` ADD PRIMARY KEY (`id`);
//添加索引username
ALTER TABLE `abc` ADD INDEX `abc` (`username`);

其它參考:
官方文檔:As indicated by the name, MEMORY tables are stored in memory. They use hash indexes by default, which makes them very fast, and very useful for creating temporary tables. However, when the server shuts down, all rows stored in MEMORY tables are lost. The tables themselves continue to exist because their definitions are stored in .frm files on disk, but they are empty when the server restarts.

可以看出來(lái)MEMORY確實(shí)是very fast,and very useful for creating temporary tables .把臨時(shí)表和內(nèi)存表放在一起使用確實(shí)會(huì)快不少:create table tmp2(id int not null) engine memory;
內(nèi)存表的建立還有一些限制條件:
MEMORY tables cannot contain BLOB or TEXT columns. HEAP不支持BLOB/TEXT列。
The server needs sufficient memory to maintain all MEMORY tables that are in use at the same time. 在同一時(shí)間需要足夠的內(nèi)存.
To free memory used by a MEMORY table when you no longer require its contents, you should execute DELETE or TRUNCATE TABLE, or remove the table altogether using DROP TABLE.為了釋放內(nèi)存,你應(yīng)該執(zhí)行DELETE FROM heap_table或DROP TABLE heap_table。

幾個(gè)關(guān)鍵參數(shù)

max_heap_table_size
mysql HEAP MEMORY tables 提高行數(shù)支持的方法
別人問(wèn)到的 記一下
mysql MEMORY tables 如果目前支持的行數(shù)到上限還不夠用 可以把 my.conf 配置里面
max_heap_table_size = 256M
改大
設(shè)置 MAX_ROWS
在跑著 可以 ALTER TABLE tbl_name MAX_ROWS=
MAX_ROWS 依賴于 max_heap_table_size 設(shè)置

標(biāo)簽:,
comments Comments (407)    -
2011/09/12 at 14:20

dede 在列表頁(yè)和文章頁(yè)調(diào)用全站最新文章

dede在首頁(yè)調(diào)用全站最新文章是這樣實(shí)現(xiàn)的

{dede:arclist titlelen=42 row=6 }
<li><a href="[field:arcurl/]">[field:title/]</a>
<p>[field:description function='cn_substr(@me,80)'/]...</p>
</li>
{/dede:arclist}

這種方式只有在首頁(yè)調(diào)用出來(lái)才是全站最新的文章,在列表頁(yè)或者文章頁(yè)調(diào)出來(lái)的是本欄目下的文章,這是系統(tǒng)固定好的,如果希望在列表頁(yè)和文章頁(yè)也調(diào)用全站的內(nèi)容,需要加上 typeid='top'這個(gè)標(biāo)簽屬性,typeid也可以指定特定的頂級(jí)欄目id。

{dede:arclist titlelen=42 row=6 typeid='top'}
<li><a href="[field:arcurl/]">[field:title/]</a>
<p>[field:description function='cn_substr(@me,80)'/]...</p>
</li>
{/dede:arclist}

標(biāo)簽:
comments Comments (452)    -
2011/09/10 at 20:56

廣珠城軌中山售票點(diǎn)-中山城軌代售點(diǎn)電話地址

廣珠城軌目前在中山的售票點(diǎn)有10個(gè),市民可在這10個(gè)代售網(wǎng)點(diǎn)購(gòu)買任意站點(diǎn)的城軌票。這10個(gè)代售點(diǎn)分布范圍很廣:沙溪有1個(gè),火炬區(qū)有2個(gè),小欖2個(gè),城區(qū)2個(gè),東升、三鄉(xiāng)、古鎮(zhèn)各1個(gè)。市民可就近購(gòu)票,無(wú)需直接前往城軌站場(chǎng)購(gòu)票。

廣珠城軌代售網(wǎng)點(diǎn)名單:

1,永佳火車售票處,沙溪鎮(zhèn)西區(qū)水牛城商業(yè)廣場(chǎng)51卡。電話:0760-87390156

2,金箭有限公司航空服務(wù)分公司(中山港壹加壹超市附近),火炬區(qū)集中新建區(qū)興隆街22棟23-24卡。電話:0760-85591298

3,盛源商務(wù)有限公司,小欖鎮(zhèn)沙口小欖大道25號(hào)。電話:0760-23820825

4,菊城假日國(guó)際旅行社有限公司,小欖新市路95號(hào)。電話:0760-22281407

5,祥達(dá)航空服務(wù)有限公司,中山三路3號(hào)。電話:0760-8324120

6,鐵青中山東升營(yíng)業(yè)處,東升鎮(zhèn)葵興大道97號(hào)之二。電話:020-61351236

7,交通運(yùn)輸倉(cāng)儲(chǔ)配載中心,中山四路33號(hào)。電話:0760-88322990

8,三鄉(xiāng)廣安售票處,三鄉(xiāng)鎮(zhèn)文安路(三鄉(xiāng)汽車站內(nèi))。電話:0760-86693815

9,通達(dá)售票服務(wù)部,火炬區(qū)東鎮(zhèn)大道15號(hào)第二卡。電話:0760-88287148

10,古鎮(zhèn)華程票務(wù)部,古鎮(zhèn)鎮(zhèn)興路4號(hào)之三。電話:0760-2324518

標(biāo)簽:, ,
comments Comments (7)    -