Yii2 PHP namespace The third-party non-namespace library file, error: Class not found resolution

Source: Internet
Author: User
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.


  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.