脚本宝典收集整理的这篇文章主要介绍了Luthier CI安装 Installation,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
安装 ( Installation )
内容 ( Contents )
- 要求 Requirements
-
安装 Installation
- 获得Luthier CI Get Luthier CI
- 启用Composer自动加载和挂钩 Enable Composer autoload and hooks
- 将Luthier CI与您的应用程序连接 Connect Luthier CI with your application
- 初始化 Initialization
要求 ( Requirements )
安装 ( Installation )
获得Luthier CI ( Get Luthier CI )
需要Composer
Luthier CI通过Composer安装。你可以在这里得到它。 here.
转到该application文件夹并执行以下命令:
composer require luthier/luthier
启用Composer autoload 和 hooks
要使Luthier CI工作,必须在框架中启用Composer 自动加载和挂钩。在文件中config.php修改以下内容:
<?php
# application/config/config.php
// (...)
$config['enable_hooks'] = TRUE;
$config['composer_autoload'] = TRUE;
// (...)
将Luthier CI与您的应用程序连接
在hooks.php文件中,将Luthier CI挂钩分配给$hook变量:
<?php
# application/config/hooks.php
defined('BASEPATH') OR exit('No direct script access Allowed');
// (...)
$hook = LuthierHook::getHooks();
在routes.php文件中,将Luthier CI路由分配给$route变量:
<?php
# application/config/routes.php
defined('BASEPATH') OR exit('No direct script access allowed');
// (...)
$route = LuthierRoute::getRoutes();
初始化 ( Initialization )
第一次执行Luthier CI时,会自动创建一些文件和文件夹:
-
routes/web.php
: HTTP路由文件
-
routes/api.php
: AJAX路由文件
-
routes/cli.php
: CLI路由文件
-
controllers/Luthier.php
: 假控制器,必须使用一些路线
-
middleware
: 用于保存中间件文件的文件夹
在框架初始化期间,调用钩子:
LuthierHook::getHooks()返回一个带有Luthier CI使用的钩子的数组,包括启动它所需的钩子。
此时,Luthier CI分析并编译上述前三个文件中定义的所有路由。
然后,当框架加载application/config/routes.php文件中的路由时,
LuthierRoute::getRoutes()返回一个数组,其中包含CodeIgniter理解的格式的路由。
以下所有内容都是框架的正常执行。
编写权限 ( Writing permissions )
如果在创建Luthier CI基本文件期间出现错误,则可能是由于权限不足。确保该 application
文件夹具有写入权限
以上是脚本宝典为你收集整理的Luthier CI安装 Installation全部内容,希望文章能够帮你解决Luthier CI安装 Installation所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。