第一步:打开终端。control + 空格,输入 terminal 回车。
第二步:临时添加环境变量
export /Users/liuxq/Sites/yii-1.1.15:$PATH
第三步:查看刚才设置的环境变量:echo $PATH
第四步:切换到web目录:cd 本项目/protected/
第五步:执行web项目里自己写的commad
php yiic command类名 controller --name=operator
其中,gii是自己写的command类,放在web项目/protected/commands 下面,名为GiiCommmand.php。controller是里面的函数,actionController。name是参数。