M
M
Maxim Lagoysky2017-04-03 20:33:40
Yii
Maxim Lagoysky, 2017-04-03 20:33:40

Did you have problems with yii2 when transferring a project from local to host?

Good evening, when transferring from a site from a local to a host, a problem appeared, it says "Class 'app\controllers\Controller' not found". I thought it was wrong, I uploaded pure yii2 to the host, everything works, but as soon as I add my controller with a view, it does not work and gives this error.
Here is the actual controller

namespace app\controllers;
use Yii;


class TestController extends Controller
{
public function actionIndex()
    {
        $this->setMeta('Rentin');
        return $this->render('index');
    }
}

I think it's pointless to throw it almost empty

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2017-04-03
@lagoy

Add use yii\web\Controller;

M
Maxim Lagoysky, 2017-04-04
@lagoy

Thanks to everyone for the answers, it seems to work, I just ran into 1 more problem (the same), I have registration and all actions with the user are placed in a separate module, and now when registering it says
Class 'app\modules\user\models\user' not found
how to specify correctly here? if the web folder is in the public_html folder, and all other files are on the same level as public_html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question