我正在尝试使用 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/