Class 'frontend\widgets\WLang' not found

Hello

Widget not working

this code

<?php

namespace yii\widgets;

class WLang extends \yii\bootstrap\Widget

{

public function init(){}





public function run() {


    return &#036;this-&gt;render('lang/view');


}

}

/*************************************************/

use frontend\widgets\WLang;

?>

<?= WLang::widget()?>

this code working on localhost and hosting not working

that may be the problem???

You have created the widget in the namespace yii\widgets

BUT

You have tried to import it from frontend\widgets, which is why you have the error.

The use statement needs to refer to the namespace and the class needs to be in a suitable location so that Yii can use the namespace to locate the correct folder to read the widget from.

If it is your widget, you can put it in frontend\widgets\WLang.php but then you need to set the widgets namespace to be frontend\widgets.