yii - 资料:
http://www.yiichina.com/guide/2/structure-modules
1.
建立文件夹:basic\modules\forum\
然后在这个文件夹下面新建文件夹:controllers,models,views,
新建文件:basic\modules\forum\Module.php
<?php
namespace app\modules\forum;
use Yii;
use yii\web\ForbiddenHttpException;
class Module extends \yii\base\Module
{
public $controllerNamespace = 'app\modules\forum\controllers';
public $allowedIPs = ['192.168.7.10', '::1'];
public $generators = [];
public $newFileMode = 0666;
public $newDirMode = 0777;
public function init()
{
parent::init();
}
}
2. \basic\config\web.php 中加入:
$config['modules']=[
'forum' => [
'class' => 'app\modules\forum\Module',
// ... other configurations for the module ...
],
];
3.basic\modules\forum\controllers\PostController.php
<?php
namespace app\modules\forum\controllers;
use yii\web\Controller;
class PostController extends Controller
{
// ...
public function actionPost(){
echo "forums post!";
}
}
?>