unexpected T_CONSTANT_ENCAPSED_STRING

前端 未结 4 1447
死守一世寂寞
死守一世寂寞 2021-01-13 18:56

Am using CakePHP running on XAMPP Server with PHP 5.3.5 i keep getting the error message syntax error, unexpected T_CONSTANT_ENCAPSED_STRING Line 38

Line 38 is \'P

4条回答
  •  离开以前
    2021-01-13 19:29

    Try and make it a bit more readable:

    $isPublished = ($post['Post']['published'] == 1) ? true : false;
    
    echo $html->link(
      ife($isPublished, 'Published','Unpublished'),
      '/posts/' . ife($isPublished, 'disabled', 'enable') . '/' . $post['Post']['id']
    );
    

提交回复
热议问题