1

我正在尝试使用 Enterprise Architect 工具通过逆向工程在 PHP 中创建组件图。但是当我尝试执行它时会发生错误。这些是错误日志:

There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 9.  Unexpected symbol: [ 
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 17.  Unexpected symbol: [    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 9.  Unexpected symbol: [ 
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 17.  Unexpected symbol: [    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 10.  Unexpected symbol: ,  
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 10.  Unexpected symbol: ,  
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 10.  Unexpected symbol: ,    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 18.  Unexpected symbol: ,    
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Client.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Sensor.php  on line 9.  Unexpected symbol: [   
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\Site.php  on line 9.  Unexpected symbol: [ 
There was an error parsing C:\Users\Utente\Dropbox\FourBit\Ingegneria\PROGETTO\Componenti Progetto\Class\User.php  on line 17.  Unexpected symbol: [    

例如,下面是Client.php的代码:

<?php

    namespace App;

    use Illuminate\Database\Eloquent\Model;

    class Client extends Model
    {
        protected $fillable = [
            'PI', 'BusinessName'
        ];

        public function address()
        {
            return $this->belongsTo(Address::class);
        }

        public function users()
        {
            return $this->hasMany(User::class);
        }

错误解析在protected $fillable = [ 'PI', 'BusinessName' ]; 我不知道这是否可以帮助你,但我正在使用 Laravel 作为框架。任何人都可以帮助我,好吗?

4

2 回答 2

3

正如其他人指出的那样,$array = [ 'key' => 'value' ];默认情况下在ea中引入了php 5.4中的语法,php生成使用5.3版本,但您可以将其更改为5.6。请按照以下屏幕截图: 单击配置功能区,然后单击选项菜单 在“管理项目选项”对话框中,您可以更改 PHP 的默认版本

于 2017-06-14T13:05:07.877 回答
2

检查您的 PHP 版本,数组语法$array = [ 'key' => 'value' ];仅在 PHP 5.5 中引入(我相信),所以任何更少都会导致语法错误。

于 2017-06-14T09:45:49.880 回答