我是一名学生,最近在作新浪微博api的接口测试。初学php,被错误弄得头昏脑胀。但遇到的问题几乎是一样的,郁闷了好几天,比如在做access_token接口测试时。代码如下:
session_start();
include_once('weibooauth.php');
include_once('config.php');
include_once('authorize.php');
include_once('request_token.php');
//oauth/access_token$o = new WeiboOAuth( WB_AKEY ,
WB_SKEY ,
$_SESSION['keys']['oauth_token'] ,
$_SESSION['keys']['oauth_token_secret'] );$last_key = $o->getAccessToken( $_REQUEST['oauth_verifier'] ) ;
echo($last_key['oauth_token']);运行后错误提示:
527e0b6ad8350c2332ef6103d1798bdf : a0bcbc2154bf9b5475e4356f33b24365
Notice: Undefined index: keys in D:\wamp\www\weibointerfacetest\access_token.php on line 17Notice: Undefined index: keys in D:\wamp\www\weibointerfacetest\access_token.php on line 18Notice: Undefined index: oauth_verifier in D:\wamp\www\weibointerfacetest\access_token.php on line 20Notice: Undefined index: oauth_token in D:\wamp\www\weibointerfacetest\weibooauth.php on line 1613Notice: Undefined index: oauth_token_secret in D:\wamp\www\weibointerfacetest\weibooauth.php on line 1613Notice: Undefined index: oauth_token in D:\wamp\www\weibointerfacetest\access_token.php on line 21错误均为变量未定义。但是在include包含的文件中变量都做了定义的。为什么会出现这种情况,请也在做新浪微博方面的大虾帮忙解答,谢谢
session_start();
include_once('weibooauth.php');
include_once('config.php');
include_once('authorize.php');
include_once('request_token.php');
//oauth/access_token$o = new WeiboOAuth( WB_AKEY ,
WB_SKEY ,
$_SESSION['keys']['oauth_token'] ,
$_SESSION['keys']['oauth_token_secret'] );$last_key = $o->getAccessToken( $_REQUEST['oauth_verifier'] ) ;
echo($last_key['oauth_token']);运行后错误提示:
527e0b6ad8350c2332ef6103d1798bdf : a0bcbc2154bf9b5475e4356f33b24365
Notice: Undefined index: keys in D:\wamp\www\weibointerfacetest\access_token.php on line 17Notice: Undefined index: keys in D:\wamp\www\weibointerfacetest\access_token.php on line 18Notice: Undefined index: oauth_verifier in D:\wamp\www\weibointerfacetest\access_token.php on line 20Notice: Undefined index: oauth_token in D:\wamp\www\weibointerfacetest\weibooauth.php on line 1613Notice: Undefined index: oauth_token_secret in D:\wamp\www\weibointerfacetest\weibooauth.php on line 1613Notice: Undefined index: oauth_token in D:\wamp\www\weibointerfacetest\access_token.php on line 21错误均为变量未定义。但是在include包含的文件中变量都做了定义的。为什么会出现这种情况,请也在做新浪微博方面的大虾帮忙解答,谢谢
$_SESSION['keys']['oauth_token'] ,
$_SESSION['keys']['oauth_token_secret'] );
这两行,问题就是说keys oauth_token 等这些变量未定义