【问题标题】:PHP syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRINGPHP 语法错误,意外 T_ENCAPSED_AND_WHITESPACE,期待 T_STRING
【发布时间】:2017-06-20 19:32:35
【问题描述】:

请帮忙。在重置密码页面上,我收到错误

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING

我的代码

To reset your password, complete this form: <?php echo URL::to(\'user/reset\', array({$token})); ?>.

如果有帮助,或者在 laravel 中使用相同的代码:

To reset your password, complete this form: {{ URL::to(\'user/reset\', array($token)) }}.

【问题讨论】:

  • 你为什么用\'而不是'来封装字符串?

标签: php laravel


【解决方案1】:

正确的语法是:

{{ URL::to('user/reset', array($token)) }}

【讨论】:

    【解决方案2】:

    您不应转义 (\) ' 字符。

    To reset your password, complete this form:
    {{ URL::to('user/reset', array($token)) }}.
    

    阅读 PHP 手册:PHP strings

    【讨论】:

      猜你喜欢
      • 2013-04-12
      • 2010-11-20
      • 2017-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-07
      • 2019-05-26
      相关资源
      最近更新 更多