shyandsy
(Shyandsy)
1
May I create new folder in the advanced template?
I created a folder named "aaa" in the base path of advanced template.
and I add code as below
<?php
namespace frontend\controllers;
use aaa\t;
class HomeController extends \yii\web\Controller
{
public function actionIndex()
{
$t = new t();
$x = $t->getVar();
return $this->render('index');
}
}
when I use that class, the php show error "not found class"
<?php
namespace frontend\controllers;
use aaa\t;
class HomeController extends \yii\web\Controller
{
public function actionIndex()
{
$t = new t();
$x = $t->getVar();
return $this->render('index');
}
}
Question:
I added new model class file \frontend\models\xxxModel. it works anywhere if I write "use \frontend\models\xxxModel"
Why this does not work?
zelenin
(Aleksandr)
2
You should add alias ‘aaa’ in bootstrap like ‘frontend’/‘common’/‘backend’. Aliases used by Yii autoloading.
thuocsinhly
(Thuocsinhly Vn)
3
May I create new folder in the advanced template?
I created a folder named "aaa" in the base path of advanced template.
and I add code as below
<?php
namespace frontend\controllers;
use aaa\t;
class HomeController extends \yii\web\Controller
{
public function actionIndex()
{
$t = new t();
$x = $t->getVar();
return $this->render('index');
}
}
when I use that class, the php show error "not found class"
<?php
namespace frontend\controllers;
use aaa\t;
class HomeController extends \yii\web\Controller
{
public function actionIndex()
{
$t = new t();
$x = $t->getVar();
return $this->render('index');
}
}
Question:
I added new model class file \frontend\models\xxxModel. it works anywhere if I write "use \frontend\models\xxxModel"
Why this does not work?
I undersant you think about diffi
shyandsy
(Shyandsy)
4
thank you very much. It works now.