資料來源:http://dorothycode.blogspot.com/2010/10/php-cache-no-cache.html
[PHP] cache禁止瀏覽器快取網頁 No Cache
避免proxy或bowser cache住你的網頁。(如此的話使用者看到的都會是舊的畫面)
HTML Meta Tag:
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache"> 舊式寫法,加是為了相容性。
<meta http-equiv="expires" content="0"> 將網頁設做立即過期。
In PHP:
<?php
// Expires in the past
header("Expires: Mon, 26 Jul 1990 05:00:00 GMT");
// Always modified
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
?>
2010年11月12日 星期五
2010年11月11日 星期四
MySQL安裝完成後服務無法啟動的解決方法
文章來源:MySQL Forums :: InnoDB :: Plugin 'InnoDB' init function returned error.
For Windows OS:
OK, I struggled with this for ages. There are various partial fixes that did not fix it for me on the web, but in the end the following worked:
If you've installed it, then uninstall (an earlier version that had been removed could have left crap that is causing an issue, so best to start off clean). Do this as follows:
- Add/Remove Programs and remove MySQL.
- Delete the Programs File/MySQL folder (it gets left behind)
- Delete the data file (where ever you stored it) #:\MySQL DataFiles > This is assuming you have no data to as yet to worry about!!!!
- Run RegEdit and delete all the MySQL Keys (search and F3) and the half a dozen or so CLSIDs that coe up with just a single non-defailt key for MySQL. You can leave ADOBE\ keys that mention it if you have dreamweaver etc. As allways back up you registry first before choppig it!
OK. Now run te install and go through the config wizard until it fails at the start up. Then close it.
Now open up Services and open MySQL properties - I set it to run under the Administrator account rather than System/ANOther to ensure it had permissions.
Next, go to your new MySQL DataFile and delete 'ibdata1'.
Then go to 'C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data' and delete all tje 'ib_logfile' prefixed files (should be 0 and 1) - useful to notice the .err log here to which is a text file.
Then go back to Services and manually start it and all should be fine.
Hopefully I have saved you a few hourse peeing around with Windows - MySQL Devs, about time this bug was fixed eh? Been hanging around a long while now and the web is chok full of unanswered or half answered requests for help. Remember - some of us have no choice but to use Windows.
For Windows OS:
OK, I struggled with this for ages. There are various partial fixes that did not fix it for me on the web, but in the end the following worked:
If you've installed it, then uninstall (an earlier version that had been removed could have left crap that is causing an issue, so best to start off clean). Do this as follows:
- Add/Remove Programs and remove MySQL.
- Delete the Programs File/MySQL folder (it gets left behind)
- Delete the data file (where ever you stored it) #:\MySQL DataFiles > This is assuming you have no data to as yet to worry about!!!!
- Run RegEdit and delete all the MySQL Keys (search and F3) and the half a dozen or so CLSIDs that coe up with just a single non-defailt key for MySQL. You can leave ADOBE\ keys that mention it if you have dreamweaver etc. As allways back up you registry first before choppig it!
OK. Now run te install and go through the config wizard until it fails at the start up. Then close it.
Now open up Services and open MySQL properties - I set it to run under the Administrator account rather than System/ANOther to ensure it had permissions.
Next, go to your new MySQL DataFile and delete 'ibdata1'.
Then go to 'C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 5.1\data' and delete all tje 'ib_logfile' prefixed files (should be 0 and 1) - useful to notice the .err log here to which is a text file.
Then go back to Services and manually start it and all should be fine.
Hopefully I have saved you a few hourse peeing around with Windows - MySQL Devs, about time this bug was fixed eh? Been hanging around a long while now and the web is chok full of unanswered or half answered requests for help. Remember - some of us have no choice but to use Windows.
2010年11月10日 星期三
邊做邊學 PHP on Windows:在 IIS7 上執行 PHP
以下內文轉載於:Microsoft MSDN
邊做邊學 PHP on Windows:在 IIS7 上執行 PHP
邊做邊學 PHP on Windows:在IIS7 上執行PHP
邊做邊學 PHP on Windows 範例影片欣賞Object reference not set to an instance of an object. |
在 IIS7 上執行 PHP
目前在許多的 Web 應用中有很多的技術可以用來開發,例如微軟的 .NET、Java 或是 PHP 等相關技術。其中 PHP 在許多的大型網站也可以看到其應用的蹤跡,但是大多數的文件都是告訴各位如何在像是 Apache 等 Web 伺服器上進行設定。本篇文章將會告訴各位,如何快速在微軟的 IIS7 上進行設定讓它也能夠順利的執行 PHP 程式。在進行設定之前,我們假設各位對 PHP 的基本配置有一定程度的瞭解,並已經完成一些基本環境:
1. 已經安裝好 IIS7 的 Windows Server 2008。
2. 下載並安裝好 PHP。
如果你的 PHP 程式有需要使用資料庫系統,那麼也可以選擇性安裝一個資料庫系統,原則上 PHP 支援市面上大多數的資料庫系統,所以除了常見的MySQL,也可以選擇使用 Microsoft SQL Server。
1. 安裝 PHP:
(a) 首先開啟瀏覽器連線到 http://www.php.net/downloads.php 下載 PHP 5.2.8 Non-thread-safe zip package 這個套件,並將它解壓縮至 C:\php5。
(b) 將 PHP 壓縮檔中所附的 php.ini-recommanded 更名為 php.ini,並依照下列說明修改內容:
(1) cgi.fix_pathinfo = 1
(2) cgi.force_redirect = 0
(3) error_log = syslog
2. PHP 程式要在 IIS 上執行主要是透過 CGI 方式來運作的,不過傳統的 CGI 很容易造成一些效能上的問題,因此現在大多數的 CGI 程式都是透過FastCGI 或 SCGI 來運行。以下的步驟將在 IIS 上安裝 FastCGI 角色服務:
(a) 打開「伺服器管理員」。
(b) 在「角色摘要」選取「網頁伺服器 (IIS)」。

(c) 在「角色服務」選取「新增角色服務」。
(d) 勾選「應用程式開發」中的「CGI」。

(e) 按「下一步」,接著點選「安裝」。
3. 設定 IIS7 以便透過 FastCGI 執行 PHP 應用程式
(a) 啟動 Internet Information Services (IIS)管理員。
(b) 在左側的樹狀節點中點選本機伺服器。
(c) 打開「處理常式對應」,點選右側「動作」的「新增模組對應」。

(d) 在對話方塊中輸入以下資訊:
(1) 要求路徑:*.php 此設定告訴 IIS 延伸檔名為 php 的檔案要經由 FastCGI 模組交由外部的 CGI 程式來執行。
(2) 模組:選取「FastCGIModule」
(3) 執行檔:C:\php5\php-cgi.exe FastCGI 模組要呼叫的 CGI 程式。
(4) 名稱:PHP via FastCGI 這個名稱只是用來識別,各位可以依照自己的需要自行命名。

(e) 點選「確定」→「是」完成設定。
4. 完成所有的設定之後,各位可以直接在 IIS7 的 Document Root 底下直接放入PHP 程式。筆者準備了一個很簡單的 PHP 示範程式,用來查詢MySQL 資料庫中的資料表內容,以下是執行結果:

您也可以試著執行您的 PHP 程式。
如何使用 CDO 物件來寄 E-Mail
以下內容轉載自強力鎯頭 の VB 部落
如何使用 CDO 物件來寄 E-Mail
CDO ( Collaboration Data Objects ) 物件 , 對應檔案 CDOSYS.dll , 供E-Mail 寄送使用;
可應用於 VB 、 ASP 、 .Net 等 , 是簡單的信件寄送方式之一
Dim objCDO As Object
Dim strCfg As String
Set objCDO = CreateObject("CDO.Message")
strCfg = "http://schemas.microsoft.com/cdo/configuration/"
With objCDO
.Sender = "別胡亂送@OhMyGod.com"
.From = "誰是寄件者@NoOneKnows.com"
.To = "要寄給誰@whois.com.tw"
.Fields("urn:schemas:mailheader:X-Priority") = 1 ' Priority = PriorityUrgent 高優先順序
.Fields("urn:schemas:mailheader:return-receipt-to") = "誰是寄件者@NoOneKnows.com" ' 要求讀取回條
' .Fields("urn:schemas:httpmail:importance") = 2 ' Importance = High
' .Fields("urn:schemas:httpmail:priority") = 1 ' Priority = PriorityUrgent
.Fields.Update ' 更新欄位
.Subject = "沒有主旨(放主題啦)"
.TextBody = "ORZ" ' Text 文字格式信件內容
' 或 HTML 網頁格式信件內容
.HTMLBody = "<HTML>" & _
"<BODY>" & _
"<table border=""1"" width=""100%"">" & _
"<tr><td>I</td><td>am</td><td>Hammer</td><td>!</td></tr>" & _
"<tr><td>Who</td><td>r</td><td>u</td><td>?</td></tr>" & _
"</table>" & _
"</BODY>" & _
"</HTML>"
.AddAttachment "C:\AttFile.zip" ' 附加檔案
.CC = "Xman@yahoo.com.tw" ' 副本
.BCC = "SpiderMan@hotmail.com.tw" ' 密件副本
.Configuration(strCfg & "sendusing") = 2 ' Sendusing = SendUsingPort
.Configuration(strCfg & "smtpserver") = "msa.hinet.net" ' SMTP Server
' .Configuration(strCfg & "smtpserverport") = 25 ' SMTP Server Port ( 預設即為 25 )
' SMTP Server 如需登錄 , 則需設定 UserName / Password
' .Configuration(strCfg & "sendusername") = "UserName" ' Send User Name
' .Configuration(strCfg & "sendpassword") = "Password" ' Send Password
.Configuration.Fields.Update ' 更新 (欄位) 組態
' .DSNOptions = 4 ' 回傳信件傳送狀態
' cdoDSNDefault = 0 , DSN commands are issued.
' cdoDSNDelay = 8 , Return a DSN if delivery is delayed.
' cdoDSNFailure = 2 , Return a DSN if delivery fails.
' cdoDSNNever = 1 , No DSNs are issued.
' cdoDSNSuccess = 4 , Return a DSN if delivery succeeds.
' cdoDSNSuccessFailOrDelay = 14 ,Return a DSN if delivery succeeds, fails, or is delayed.
.Send ' 傳送
End With
Set objCDO = Nothing
以上內容轉載自強力鎯頭 の VB 部落
其他參考資料:http://www.pro-soho.com/blog/article.asp?id=295
CDO 郵件元件使用方法
Microsoft從Windows Server 2000 及 Windows XP開始內建郵件元件已改為CDO
在之前的系統內建郵件元件則是 CDONTS,各位要注意,以下是CDO的用法
屬性 說明
Subject 郵件的主旨
From 寄件人的電子郵件信箱
To 收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
CC 副本收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
BCC 密送副本收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
TextBody 郵件的本文-純文字模式
HTMLBody 郵件的本文-HTML模式
以上內容轉載自強力鎯頭 の VB 部落
其他參考資料:http://www.pro-soho.com/blog/article.asp?id=295
CDO 郵件元件使用方法
Microsoft從Windows Server 2000 及 Windows XP開始內建郵件元件已改為CDO
在之前的系統內建郵件元件則是 CDONTS,各位要注意,以下是CDO的用法
屬性 說明
Subject 郵件的主旨
From 寄件人的電子郵件信箱
To 收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
CC 副本收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
BCC 密送副本收件人的電子郵件,可用分號;或逗號,斷開成多位收件人
TextBody 郵件的本文-純文字模式
HTMLBody 郵件的本文-HTML模式
訂閱:
文章 (Atom)