💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 自动加载 > composer.json ~~~ "autoload": { "psr-4": { "Application\\": "module/Application/src/", "Album\\": "module/Album/src/", "Blog\\": "module/Blog/src/" } } ~~~ 执行 ~~~ composer dump-autoload ~~~ ### 模块管理器 > module/Blog/src/Module.php ~~~ <?php namespace Blog; class Module { public function getConfig() { return include __DIR__ . '/../config/module.config.php'; } } ~~~ **模块配置** > module/Blog/config/module.config.php ~~~ <?php namespace Blog; use Zend\Router\Http\Literal; use Zend\ServiceManager\Factory\InvokableFactory; return [ // This lines opens the configuration for the RouteManager 'router' => [ // Open configuration for all possible routes 'routes' => [ // Define a new route called "blog" 'blog' => [ // Define a "literal" route type: 'type' => Literal::class, // Configure the route itself 'options' => [ // Listen to "/blog" as uri: 'route' => '/blog', // Define default controller and action to be called when // this route is matched 'defaults' => [ 'controller' => Controller\ListController::class, 'action' => 'index', ], ], ], ], ], 'controllers' => [ 'factories' => [ Controller\ListController::class => InvokableFactory::class, ], ], 'view_manager' => [ 'template_path_stack' => [ __DIR__ . '/../view', ], ], ]; ~~~ ### 控制器 > [module/Blog/src/Controller/ListController.php](https://gitee.com/netjoin/zendframework3-demo/blob/master/module/Blog/src/Controller/ListController.php) ~~~ <?php namespace Blog\Controller; use Zend\Mvc\Controller\AbstractActionController; class ListController extends AbstractActionController { } ~~~ **视图** > [module/Blog/view/blog/list/index.phtml](https://gitee.com/netjoin/zendframework3-demo/blob/master/module/Blog/view/blog/list/index.phtml) ~~~ <h1>Blog\ListController::indexAction()</h1> ~~~