1.php.ini設定
session.cookie_domain = .mydomain.com
2‧ini_set(“session.cookie_domain”, “.mydomain.com.tw”); (記得放在session_start()前)
3‧session_set_cookie_params(0,’/’,’.mydomain.com.tw’,0);(記得放在session_start()前)
大型網站架構..net 架構師.rabbitMQ.redis.行動開發.APP開發教學.PHP Laravel開發..net core C# 開發.架構師之路.Delphi開發.資料庫程式.進銷存.餐飲POS系統
1.php.ini設定
session.cookie_domain = .mydomain.com
2‧ini_set(“session.cookie_domain”, “.mydomain.com.tw”); (記得放在session_start()前)
3‧session_set_cookie_params(0,’/’,’.mydomain.com.tw’,0);(記得放在session_start()前)
ini_set('session.cookie_lifetime', 0);
來源 Cross-Browser Session Starter
[php]
<?php// $expire = the time in seconds until a session have to expire
function start_session($expire = 0) {
if ($expire == 0) {
$expire = ini_get("session.gc_maxlifetime");
} else {
ini_set("session.gc_maxlifetime", $expire);
}
if (empty($_COOKIE['PHPSESSID'])) {
session_set_cookie_params($expire);
session_start();
} else {
session_start();
setcookie("PHPSESSID", session_id(), time() + $expire);
}
}
// this example will start a session with an expire time given by the php configuration
start_session();
// start_session(600) will start a session which will expire after 10 minutes (60*10 seconds)
?>
[/php]
沒記錯的話,美國史丹佛大學從2009年就開始在iTunes上有一門免費的「CS 193P iPhone Application Development」課程。
2013年的「Developing iOS 7 Apps for iPhone and iPad」也出爐了!
課程網址: https://itunes.apple.com/us/course/developing-ios-7-apps-for/id733644550
Windows架設Apache、MySQL、PHP的環境主要是使用Appserv或可以直接解壓縮執行的XAMPP,雖然XAMPP也提供在Mac上安裝,不過似乎不是很穩定(也許是因為跨平台的關係吧)。anyway~在Mac上架設Apache、MySQL、PHP難道就要一個個安裝?
終於找到了MAMP這個簡單的懶人包!而且還是全圖形介面~
安裝完成後,可以在應用程式看到WAMP及WAMP PRO(付費版本)的資料夾,我們點開WAMP資料夾下面的WAMP應用程式。
接著會詢問你要開啟的是免費版本或付費版本,我們點Launch MAMP
打開之後,點選Start Servers讓Apache Server、MySQL Server亮綠燈
按Open Start Page可以看到MAMP的首頁,就表示完成了!
就著我們點進Preferences看看
在Start/Stop可以選擇,打開(關閉)MAMP時是否自動開啟(關閉)Apache/MySQL伺服器、程式開啟時是否檢查開啟MAMP Pro、以及開啟程式是否自動開啟 Start page以及Start Page的位置。
這邊可以稍徵調整一下Port位置,apache為80,MySQL則是3306。
還可以選PHP版本
指定Apache Document Root。
MAMP圖形化且穩定可以減少開發上許多的不便,朋友們可以嘗試使用囉。
相關連結:
Appserv官網: http://www.appservnetwork.com
XAMPP官網: http://www.apachefriends.org/zh_tw/xampp.html
MAMP官網: http://www.mamp.info/en/index.html
Embarcadero裡的David I是我蠻崇拜的前輩,當了44年開發者也不厭倦。
在ZendCon裡示範用Delphi XE5使用 APIs, REST/JSON控制LED、quadcopter以及其他硬體。
早上打開XE5發現有新的update了
http://docwiki.embarcadero.com/RADStudio/XE5/en/Release_Notes_for_XE5_Update_1
修正的bug如網頁連結:http://edn.embarcadero.com/article/43468
下載連結
把手上的Delphi7自動發送簡訊系統轉到XE3,發現一直出現亂碼。
後來找到原因是IdHTTP.URL.ParamsEncode的問題,在Delphi7跟Delphi XE3處理出來的結果是不同的,於是在網路上找到一段改編自Delphi 7的版本。果然就行了!
[pascal]
function EnCode(ACode: string): string;
var
I: Integer;
Hex: string;
Code: AnsiString;
begin
Code := AnsiString(ACode);
for I := 1 to Length(Code) do
case Code[i] of
‘ ‘: Result := Result + ‘+’;
‘A’..’Z’, ‘a’..’z’, ‘*’, ‘@’, ‘.’, ‘_’, ‘-‘,
‘0’..’9′, ‘$’, ‘!’, ””, ‘(‘, ‘)’:
Result := Result + Code[i];
else
begin
Hex := IntToHex(ord(Code[i]), 2);
if Length(Hex) = 2 then
Result := Result + ‘%’ + Hex
else
Result := Result + ‘%0’ + hex;
end;
end;
end;
[/pascal]
Delphi已經邁向18年的歷史了,幾乎每一年都出了新的版本,而每個版本也幾乎都有令人驚艷的功能存在。
如果您是老Delphi 開發者,不妨可以回鍋體驗Delphi XE5開發 iOS、Android的樂趣。
如果您是新Delphi 開發者,也許可以嘗試使用Delphi XE5開發 iOS、Android的評估。
1995-Delphi1(windows3.1)
1996-Delphi2(windows95)
1997-Delphi3
1998-Delphi4(windows98)
1999-Delphi5
2001-Delphi6(dbexpress)
2002-Delphi7
2003-Delphi8(支援.net)
2004-Delphi2005
2005-Delphi2006
2006-Delphi2007
2008-Delphi2009
2009-Delphi2010
2010-Delphi XE
2011-Delphi XE2
2012-Delphi XE3
2013(April)-Delphi XE4 (iOS)
2013(Septemper)-Delphi XE5 (Android)
一直習慣使用純PHP寫程式,不過最近看到許多徵才網站都寫著會使用CodeIgniter框架更佳。於是就來學習使用看看,沒想到還真的簡單易用,分享給大家。
1. 到CodeIgniter官方網站下載(http://ellislab.com/codeigniter),或是目前台灣也有繁體中文網站(http://www.codeigniter.org.tw/)。
2.下載後解壓縮,只要上傳application、system二個目錄及index.php到主機即可。
3.確認上傳後,就可以看到Welcome to CodeIgniter!
4.恭禧您!已經踏入CodeIgniter了XDDD
之前曾經分享過,手機版的Line可以透過 line://msg/<CONTENT TYPE>/<CONTENT KEY> 這樣的語法呼叫Line 的程式分享。
當然Delphi XE5也可以透過程式呼叫程式才對,在Jim McKeeth 的「Sending a URL to Another App on Android and iOS with Delphi XE5」文章有教您如何呼叫
iOS特殊語法
Android特殊語法
作者在文中有提到使用TidURL.URLEncode 。
[pascal]
unit OpenViewUrl;
interface
// URLEncode is performed on the URL
// so you need to format it protocol://path
function OpenURL(const URL: string; const DisplayError: Boolean = False): Boolean;
implementation
uses
IdURI, SysUtils, Classes, FMX.Dialogs,
{$IFDEF ANDROID}
FMX.Helpers.Android, Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.Net, Androidapi.JNI.JavaTypes;
{$ELSE}
{$IFDEF IOS}
iOSapi.Foundation, FMX.Helpers.iOS;
{$ENDIF IOS}
{$ENDIF ANDROID}
function OpenURL(const URL: string; const DisplayError: Boolean = False): Boolean;
{$IFDEF ANDROID}
var
Intent: JIntent;
begin
// There may be an issue with the geo: prefix and URLEncode.
// will need to research
Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_VIEW,
TJnet_Uri.JavaClass.parse(StringToJString(TIdURI.URLEncode(URL))));
try
SharedActivity.startActivity(Intent);
exit(true);
except
on e: Exception do
begin
if DisplayError then ShowMessage(‘Error: ‘ + e.Message);
exit(false);
end;
end;
end;
{$ELSE}
{$IFDEF IOS}
var
NSU: NSUrl;
begin
// iOS doesn’t like spaces, so URL encode is important.
NSU := StrToNSUrl(TIdURI.URLEncode(URL));
if SharedApplication.canOpenURL(NSU) then
exit(SharedApplication.openUrl(NSU))
else
begin
if DisplayError then
ShowMessage(‘Error: Opening "’ + URL + ‘" not supported.’);
exit(false);
end;
end;
{$ELSE}
begin
raise Exception.Create(‘Not supported!’);
end;
{$ENDIF IOS}
{$ENDIF ANDROID}
end.
[/pascal]