
用import加载类,也不行,请问怎么解决?
我把sdk目录放在,ThinkPHP/Library/Common/Util
IndexController.class.php
namespace Home\Controller;
use Think\Controller;
use Common\Util\ThinkOauth;
class IndexController extends Controller{
}
ThinkOauth.class.phpnamespace Common\Util;
abstract class ThinkOauth{
...
/**
* 取得Oauth实例
* @static
* @return mixed 返回Oauth
*/
public static function getInstance($type, $token = null) {
$name = ucfirst(strtolower($type)) . 'SDK';
require_once "sdk/{$name}.class.php";
if (class_exists($name)) {
return new $name($token);
} else {
E(L('_CLASS_NOT_EXIST_') . ':' . $name);
}
}
...
}
SinaSDK.class.phpnamespace Common\Util\sdk;
use Common\Util\ThinkOauth;
class SinaSDK extends ThinkOauth{
}
最佳答案
