php - "Failed to open stream"错误,创建新迁移时

标签 php yii yii-migrations

我正在尝试使用 yii 迁移系统,但在执行此命令时遇到此错误:

   ./yiic migrate create basic_data_migrate

我收到这个错误:

PHP Error[2]: file_get_contents(C:\Bitnami\wappstack-5.4.28-0\apache2\htdocs\cv360\protected\migrations\template.php): failed to open stream: No such file or directory
    in file C:\Bitnami\wappstack-5.4.28-0\apache2\htdocs\yii\framework\cli\commands\MigrateCommand.php at line 555

template.php 是什么?如何解决这个问题。

最佳答案

当生成一个新的迁移文件时,迁移命令使用一个模板来创建一个包含基本指令的 php 文件。

Yii 默认使用自己的模板文件,但您可以定义自己的模板文件。在您的情况下,您似乎设置了 templateFile 参数,但您没有任何模板。

在你的配置文件中找到像这样的东西:

'commandMap' => array(
        'migrate' => array(
            'class' => 'system.cli.commands.MigrateCommand',
            'migrationPath' => 'application.migrations',
            'templateFile' => 'application.migrations.template'//This should be removed
        )
    ),

并删除行 templateFile

关于php - "Failed to open stream"错误,创建新迁移时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24183957/

相关文章:

php - Woocommerce Order API 行项目 ID 在更新时更改

javascript - FrameId 未定义

php - Yii 1.1自定义错误处理我的 Controller

yii - 引用 yii 中的关系应用默认范围

yii - 使用迁移创建具有主键的列

php/css 错误,不要将 Style 加载到某些对象

php - 如何创建返回结果集的数组并计算 PHP 中数据库中每个组的不同类型值

php - JQuery GET 仅在第一次有效,第二次我只是得到服务器响应...为什么?