#1 陈景山
今天在上面配置了一天,还是不好用,另外请教下,SAE上面的使用有什么限制?方便的话
发我邮箱:scufox¥foxmail.com (@用¥代替了) 或者在论坛里给出来吧
谢谢!
2010-12-23 22:08:30
2010-12-23 22:08:30
2010-12-24 07:53:29
即可使用类似/main-write.html的URL了。
define("APP_PATH",dirname(__FILE__));
define("SP_PATH",APP_PATH.'/SpeedPHP');
$spConfig = array(
'view' => array( // 视图配置
'enabled' => TRUE, // 开启视图
'config' =>array(
'template_dir' => APP_PATH.'/tpl', // 模板目录
'left_delimiter' => '<{', // smarty左限定符
'right_delimiter' => '}>', // smarty右限定符
),
'debugging' => TRUE, // 是否开启视图调试功能,在部署模式下无法开启视图调试功能
'engine_name' => 'Smarty', // 模板引擎的类名称,默认为Smarty
'engine_path' => SP_PATH.'/Drivers/Smarty/Smarty.class.php', // 模板引擎主类路径
),
'launch' => array(
'router_prefilter' => array(
array('spUrlRewrite', 'setReWrite'),
),
'function_url' => array(
array("spUrlRewrite", "getReWrite"),
),
),
'ext' => array(
'spUrlRewrite' => array(
'suffix' => '.html',
'sep' => '-',
),
),
);
require(SP_PATH."/SpeedPHP.php");
spRun();
2010-12-24 09:05:56
2010-12-24 10:25:47
2010-12-24 11:11:29
2010-12-24 12:01:43
2010-12-24 12:06:43
include_once( 'config.php' );
include_once( 'saet.ex.class.php' );
class main extends spController
{
function index(){ // 这里是首页
//$tpl = $this->spArgs("tpl", "blue"); // 这里接收tpl参数,使得模板变化
//$guestbook = spClass("guestbook");
//$this->results = $guestbook->findAll();
//$this->display("{$tpl}/index.html");
/**认证相关代码---START*/
$o = new SaeTOAuth( WB_AKEY , WB_SKEY );
$port = '';
//echo $_SERVER['SERVER_PORT'];
if( $_SERVER['SERVER_PORT'] != 80 ) $port = ':'.$_SERVER['SERVER_PORT'];
$keys = $o->getRequestToken();
$posturl = spUrl("main", "callback");
$aurl = $o->getAuthorizeURL( $keys['oauth_token'] ,false , 'http://' . $_SERVER['HTTP_APPNAME'] . '.sinaapp.com' . $port .$posturl);
$_SESSION['keys'] = $keys;
echo '
';
echo $posturl;
echo '
';
echo "点击认识";
echo "留言成功,返回";
/**认证相关代码---END*/
}
//回调
function callback(){
$o = new SaeTOAuth( WB_AKEY , WB_SKEY , $_SESSION['keys']['oauth_token'] , $_SESSION['keys']['oauth_token_secret'] );
$last_key = $o->getAccessToken( $_REQUEST['oauth_verifier'] ) ;
$_SESSION['last_key'] = $last_key;
$this->display("callback.html");
}
//进入正式首页
function index1(){
}
function write(){ // 这里是留言
$guestbook = spClass("guestbook");
$newrow = array( // 这里制作新增记录的值
'name' => $this->spArgs('name'),
'title' => $this->spArgs('title'), // 从spArgs获取到表单提交上来的title
'contents' => $this->spArgs('contents'),
);
$guestbook->create($newrow);
echo "留言成功,返回";
}
}
2010-12-24 14:58:55
2010-12-24 15:24:58
2010-12-24 20:31:16
2010-12-24 21:30:37
2010-12-24 22:08:10
2010-12-25 00:11:23
2010-12-25 09:06:02
2010-12-25 11:28:45