Yii2.0 初始化项目时提示报错(为什么那么多中括号) [ 新手入门 ]
执行CMD命令init
Parse error: syntax error, unexpected '[' in <div style="color:#ff00000;">项目路径</div>\yii\init on line 75
PHP Parse error: syntax error, unexpected '[' in /home/wwwroot/yii/init on line 75
第75--80行代码如下:
$callbacks = ['setCookieValidationKey', 'setWritable', 'setExecutable'];
foreach ($callbacks as $callback) {
if (!empty($env[$callback])) {
$callback($root, $env[$callback]);
}
}
好像是密钥之类 请问如何解决
将相关中括号都改成php中数组形式的括号,包括environments目录下index.php文件都修改,提示如下:
Which environment do you want the application to be initialized in?
[0] Development
[1] Production
Your choice [0-1, or "q" to quit] 1
Initialize the application under 'Production' environment? [yes|no] yes
Start initialization ...
generate backend/config/main-local.php
generate backend/config/params-local.php
generate backend/web/index.php
generate common/config/main-local.php
generate common/config/params-local.php
generate console/config/main-local.php
generate console/config/params-local.php
generate frontend/config/main-local.php
generate frontend/config/params-local.php
generate frontend/web/index.php
generate yii
generate cookie validation key in backend/config/main-local.php
generate cookie validation key in frontend/config/main-local.php
chmod 0777 backend/runtime
chmod 0777 backend/web/assets
chmod 0777 frontend/runtime
chmod 0777 frontend/web/assets
chmod 0755 yii
... initialization completed.
但是还是没有生成入口文件啊
共 4 条回复
-
dingling136 回复于 2014-12-21 20:30 举报
PHP Parse error: syntax error, unexpected '[' in /home/wwwroot/yii/init on line 75
-
dingling136 回复于 2014-12-21 20:41 举报
将相关中括号都改成php中数组形式的括号,包括environments目录下index.php文件都修改,提示如下:
Which environment do you want the application to be initialized in? [0] Development [1] Production Your choice [0-1, or "q" to quit] 1 Initialize the application under 'Production' environment? [yes|no] yes Start initialization ... generate backend/config/main-local.php generate backend/config/params-local.php generate backend/web/index.php generate common/config/main-local.php generate common/config/params-local.php generate console/config/main-local.php generate console/config/params-local.php generate frontend/config/main-local.php generate frontend/config/params-local.php generate frontend/web/index.php generate yii generate cookie validation key in backend/config/main-local.php generate cookie validation key in frontend/config/main-local.php chmod 0777 backend/runtime chmod 0777 backend/web/assets chmod 0777 frontend/runtime chmod 0777 frontend/web/assets chmod 0755 yii ... initialization completed.
但是还是没有生成入口文件啊
dingling136
注册时间:2014-12-21
最后登录:2014-12-21
在线时长:0小时52分
最后登录:2014-12-21
在线时长:0小时52分
- 粉丝0
- 金钱20
- 威望0
- 积分20