Home > php教程 > php手册 > body text

用Yii自带的命令行创建应用的方法

WBOY
Release: 2016-06-06 20:10:18
Original
1420 people have browsed it

配置文件路径: protected/config/console.php 文件创建路径: protected/commands/TestCommand.php 类定义: class TestCommand extends CConsoleCommand {} 函数定义: public function actionFun1($param1 , $param2){} 命令行调用方法: php yiic Test F


配置文件路径:protected/config/console.php

文件创建路径:protected/commands/TestCommand.php

类定义:class TestCommand extends CConsoleCommand {}

函数定义:public function actionFun1($param1 , $param2){}

命令行调用方法:php yiic Test Fun1 –param1=参数1 –param2=参数2

文件创建、类定义和函数定义基本和yii中的其它定义方法一样。
这样做的好处是即能实现在命令行下的一些操作(如定时任务、守护进程),又能不脱离web app。

本文标题:用Yii自带的命令行创建应用的方法

本文链接:http://www.maben.com.cn/archives/585.html转载请注明出处

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!