简体   繁体   中英

Syntax error, unexpected '[', expecting ')'

Symfony \\ Component \\ Debug \\ Exception \\ FatalErrorException syntax error, unexpected '[', expecting ')'

<?php echo Form::open(['to' => 'product-search', 'autocomplete' => 'off', 'id' => 'form-product-search', 'class' => 'form-inline', 'style' => 'text-align:center']); ?>

I'm not sure why i'm receiving this error after i migrate to ubuntu server. it used to be working fine on WAMP.

I tried commenting the code out too, it gives the same error, Any idea?

You might run on PHP < 5.4 , so you need to define the array with the classic definition:

 <?php echo Form::open(array('to' => 'product-search', 'autocomplete' => 'off', 'id' => 'form-product-search', 'class' => 'form-inline', 'style' => 'text-align:center')); ?>

(and do this on every array declaration with [] )... or upgrade to PHP 5.4+ :-)

This error is occured due to your PHP Version.

['to' => 'product-search', 'autocomplete' => 'off', 'id' => 'form-product-search', 'class' => 'form-inline', 'style' => 'text-align:center']

You can't defined array like this in PHP < 5.4 version .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM