Yii2 PHP Namespace introduction of third-party non-namespace library files, error: Class not found resolution
Namespace Library mode for a class file
The class is introduced in the following way, with the error class not Found:
namespace Frontend\block\customer\account;use yii;use frontend\block\blockbase;//use yii\base\model;//use backend\ Models\helper\base.phpuse Frontend\models\core\request;use Frontend\models\core\customer;use Frontend\models\core \user;use frontend\models\core\url;use frontend\models\core\func;use frontend\models\core\email;use frontend\ Models\core\help;use frontend\models\core\session;use Frontend\models\core\config;use Frontend\models\core\Store; Use Frontend\models\core\message;use frontend\models\core\date;use frontend\models\core\mongodb;use Facebook\ Facebooksession;use Facebook\facebookredirectloginhelper;use Facebook\facebookrequest;use Facebook\ Facebookresponse;use Facebook\facebooksdkexception;use Facebook\facebookrequestexception;use Facebook\ Facebookauthorizationexception;use Facebook\graphobject;use Facebook\entities\accesstoken;use Facebook\ Httpclients\facebookcurlhttpclient;use Facebook\httpclients\facebookhttpable;class Login extends Blockbase{public function GetgooglelogInurl () {$lib _google_base = Yii::getalias ("@common/lib/google"); echo $lib _google_base. ' /social.php '; exit; $lib _google_base = Yii::getalias ("@common/lib/google"); Include $lib _google_base. ' /social.php '; $Social _obj= new Social (); $url = $Social _obj->google (); return $url; }}
Need to put $social_obj= new social (); Change to:
$Social _obj= new \social ();
That is, adding a backslash, haha, tossing me for 1 hours.
http://www.bkjia.com/PHPjc/987985.html www.bkjia.com true http://www.bkjia.com/PHPjc/987985.html techarticle Yii2 php Namespace introduction of third-party non-namespace library files, error: Class not found to solve a class file namespace library mode by the following way to introduce classes, error Cla ...