In PHP, an error is reported: “classweibo\\rests\\oauth2\datetimeAnalysis and Solution of Not Found”
1. In Yii 2, the error is reported: “classweibo\\rests\\oauth2\datetimenot found”
$urlsigner->signparams($route, false, (new datetime())->add(new dateinterval(pt1h)));
{
"name": "exception",
"message": "classweibo\\rests\\oauth2\datetimenot found",
"code": 0,
"type": "error",
"file": "E:\\wwwroot\\channel-pub-api\\weibo\\rests\oauth2\\authorizeAction.php",
"line": 129,
"stack-trace":[
"#0 [internal function]#atfp_close_translate_span#: weibo\\rests\oauth2\\authorizeAction->run()",
"#1 e:\\wwwroot\\channel-pub-api\\vendor\yiisoft\yii2\\base\\action.php(94): call_user_func_array(array, array)",
"#2 e:\\wwwroot\\channel-pub-api\vendor\yiisoft\yii2\\base\\controller.php(157): yii\\base\\action->runWithParams(array)",
"#3 e:\\wwwroot\\channel-pub-api\vendor\yiisoft\yii2\\base\\module.php(528): yii\\base\\controller->RunAction(Authorize, array)",
"#4 e:\\wwwroot\\channel-pub-api\\vendor\yiisoft\yii2\web\application.php(103): yii\\base\\module->RunAction(v1/oauth2/autho..., array)",
"#5 e:\\wwwroot\\channel-pub-api\\vendor\yiisoft\yii2\\base\application.php(386): yii\\web\\application->handleRequest(object(yii\\web\\request))",
"#6 E:\\wwwroot\\channel-pub-api\\weibo\web\\index.php(17): yii\\base\\application->run()",
"#7 {main}"
]
}
2. Since the namespace is used, in order to solve the problem of finding a class definition in the namespace, you need to add a preamble \ before the class name
$urlsigner->signparams($route, false, (new \datetime())->add(new \dateinterval(pt1h)));