Home  >  Article  >  Backend Development  >  Yii使用migrate命令执行sql语句的方法_php实例

Yii使用migrate命令执行sql语句的方法_php实例

WBOY
WBOYOriginal
2016-06-07 17:08:48750browse

本文实例讲述了Yii使用migrate命令执行sql语句的方法。分享给大家供大家参考,具体如下:

Yii2自带一个强大的命令行管理工具,在windows下打卡cmd命令窗口,切换到Yii项目所在目录(包含Yii.bat),就可以在cmd中运行Yii命令了。

使用Yii migrate命令执行sql语句:

如在路径为/console/migrations/m130524_201442_init.php这个文件定义了一张User表的sql,我们要执行这个sql来生成数据表,就运行:

yii migrate console/migrations/m130524_201442_init.php

migrate是Yii用于数据迁移的命令,这只是其中一个用法。

转自:小谈博客 http://www.tantengvip.com/2015/05/yii-migrate-sql/

更多关于Yii相关内容感兴趣的读者可查看本站专题:《Yii框架入门及常用技巧总结》、《php优秀开发框架总结》、《smarty模板入门基础教程》、《php日期与时间用法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家基于Yii框架的PHP程序设计有所帮助。

Statement:
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