PHP语法错误,意外T_ENCAPSED_AND_WHITESPACE,期待T_STRING

时间:2017-02-03 12:13:47

标签: php laravel

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

NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitHour fromDate:[NSDate date]];
[components setTimeZone:[NSTimeZone localTimeZone]];
NSInteger hour = [components hour];

if(hour >= 6 && hour < 12)
    NSLog(@"Good morning!");
else if(hour >= 12 && hour < 17)
    NSLog(@"Good afternoon!");
else if(hour >= 17 && hour < 20)
    NSLog(@"Good evening!");
else if((hour >= 20) || (hour >= 0 && hour < 6))
    NSLog(@"Good night!");

我的代码

syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING

或laravel中的相同代码,如果这有帮助:

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

2 个答案:

答案 0 :(得分:2)

正确的语法是:

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

答案 1 :(得分:0)

你不应该逃避(\'个字符。

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

阅读PHP手册:PHP strings