关于Luthier CI 命名行模式

栏目: jQuery · 发布时间: 5年前

内容简介:感谢Luthier CI,您可以通过命令行界面(CLI)利用框架提供的各种可能性。CLI路由的语法类似于HTTP和AJAX路由。必须在application/routes/cli.php文件中定义CLI路由例:

感谢Luthier CI,您可以通过命令行界面(CLI)利用框架提供的各种可能性。

CLI路由的语法类似于HTTP和AJAX路由。必须在application/routes/cli.php文件中定义CLI路由

例:

<?php
# application/routes/cli.php

// Using anonymous functions
Route::cli('test', function(){ // <- (note that here the method is 'cli' and not 'get', 'post', etc.)
    echo 'Hello world!';
});

// Pointing to an existing controller
Route::cli('test2', 'foo@bar');
复制代码

CLI路由共享与HTTP / AJAX对应的相同属性,您可以在此处了解有关它们的更多信息。

CLI路由共享与HTTP / AJAX对应的相同属性,您可以在此处了解有关它们的更多信息。

例:

$ php path/to/app/index.php [segment1] [segument2] ... [segmentN]
复制代码

所以,有这条路线:

Route::cli('make/controller/{name}', function($name){
    echo 'Making the controller ' . $name ;
});
复制代码

它可以通过运行访问:

$ php path/to/app/index.php make controller test
复制代码

结果将是:

Making the controller test
复制代码

从版本0.2.0开始,Luthier CI附带了几个命令行工具,可以帮助您完成一些重复性任务。

写入权限 确保该application文件夹具有写入权限,以便这些命令正常工作

仅适用于开发 出于安全原因,如果您的应用程序配置了testing或production环境 ,则将禁用这些命令

默认情况下禁用CLI工具。要激活它们,只需在路线文件中添加几行

<?php
# application/routes/cli.php

Luthier\Cli::maker();      // 'luthier make' command
Luthier\Cli::migrations(); // 'luthier migrate' command
复制代码

luthier make command

这允许生成各种各样的框架文件。

句法:

$ php index.php luthier make [resource] [name] [type?(sequenatial|date)=date]
复制代码

其中resource是资源的类型(controller,model,helper,library,middleware或migration),name是资源的名称和type(在创建迁移的情况下)被迁移以产生类型。

例子:

// Creating a controller:
$ php index.php luthier make controller ControllerName

// Creating a model:
$ php index.php luthier make model ModelName

// Creating a library:
$ php index.php luthier make library LibraryName

// Creating a helper:
$ php index.php luthier make helper HelperName

// Creating a middleware:
$ php index.php luthier make middleware MiddlewareName

// Creating a migration (by default, migrations are created by date)
$ php index.php luthier make migration create_users_table
$ php index.php luthier make migration create_users_table date
$ php index.php luthier make migration create_users_table sequential
复制代码

luthier migrate command

运行(或回滚)迁移。

句法

$ php index.php luthier migrate [version?=latest]
复制代码

version要运行的迁移的版本在哪里。如果省略,它将继续迁移到最新的可用版本。

也可以使用以下特殊值之一version:

reverse
refresh

例子:

$ php index.php luthier migrate reverse
$ php index.php luthier migrate refresh
复制代码

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

ggplot2:数据分析与图形艺术

ggplot2:数据分析与图形艺术

哈德利·威克姆 (Hadley Wickham) / 统计之都 / 西安交通大学出版社 / 2013-5-1 / CNY 46.00

中译本序 每当我们看到一个新的软件,第一反应会是:为什么又要发明一个新软件?ggplot2是R世界里相对还比较年轻的一个包,在它之前,官方R已经有自己的基础图形系统(graphics包)和网格图形系统(grid包),并且Deepayan Sarkar也开发了lattice包,看起来R的世界对图形的支持已经足够强大了。那么我们不禁要问,为什么还要发明一套新的系统? 设计理念 打个比......一起来看看 《ggplot2:数据分析与图形艺术》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具