-2

I have this line of code, unfortunately though it has a syntax error:

Parse error: syntax error, unexpected T_DOUBLE_ARROW on line 1

Here is the code:

<?php echo $this->Html->link('View/Edit', array('action' => 'view', $client['Client']['id']), "?" => array('nc' => time(), array('class' => 'view')); ?>

Where is the mistake in here and how can I get this resolved?

4

1 回答 1

3

Use indentation and this will be clear:

<?php 
echo $this->Html->link(
    'View/Edit', 
    array(
        'action' => 'view', 
         $client['Client']['id']
     ), 
    "?" => array(
        'nc' => time(), 
        array(
           'class' => 'view'
        )
    ); 
?>

As you can see, you have closed an array after $client['Client']['id'], so "?" => is treated as parameter to link function and causing an error.

于 2013-03-30T08:16:49.780 回答