This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d: | |
cd D:\DEV\Google\ | |
"google_appengine\dev_appserver.py" HelloGAEProject/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo 'Hello, World!'; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application: helloworld | |
version: 1 | |
runtime: php | |
api_version: 1 | |
handlers: | |
- url: /.* | |
script: helloworld.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'google/appengine/api/users/UserService.php'; | |
use google\appengine\api\users\User; | |
use google\appengine\api\users\UserService; | |
$user = UserService::getCurrentUser(); // 如果使用者已經登入,此處的$user不為null | |
if ($user===null) { | |
header('Location: ' . // 如果未登入,將使用者導向登入頁面, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
application: helloworld | |
version: 1 | |
runtime: php | |
api_version: 1 | |
handlers: | |
- url: /stylesheets #當GAE收到http request帶有"stylesheets"字樣的URL時 | |
static_dir: stylesheets #,會去"stylesheets"這個資料夾找相對應的資源顯示給使用者 | |
- url: /.* #除此之外,其他的request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<link type="text/css" rel="stylesheet" href="/stylesheets/main.css" /> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Production on Google Cloud SQL | |
$db = new PDO('mysql:unix_socket=/cloudsql/regal-center-453:guestbook;dbname=guestbook;charset=utf8','root', ''); // 不用指定密碼因為已經給該project/application權限 | |
// Development on Local Machine | |
$db = new PDO('mysql:host=localhost;dbname=guestbook'); // 我沒指定帳號密碼因為我GRANT ALL ON *.* to '@locahost' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"google_appengine/appcfg.py" update HelloGAEProject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'google/appengine/api/users/UserService.php'; | |
use google\appengine\api\users\User; | |
use google\appengine\api\users\UserService; | |
$user = UserService::getCurrentUser(); // 如果使用者已經登入,此處的$user不為null | |
if ($user===null) { | |
header('Location: ' . // 如果未登入,將使用者導向登入頁面, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE `guestbook` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; | |
USE `guestbook`; | |
CREATE TABLE `message` ( | |
`id` int(10) NOT NULL auto_increment, | |
`message` text NOT NULL, | |
`user` varchar(50) NOT NULL, | |
PRIMARY KEY (`id`) |
OlderNewer