douchi0638 2018-01-18 05:02
浏览 132
已采纳

当我尝试在laravel中发送重置密码链接时出现解析错误

I am using Laravel 5.4. I am getting error when i try to request password reset link.

Symfony\Component\Debug\Exception\FatalThrowableErrorPOST /password/email Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)

File that error is pointing to is this ( at line 'return $next($request)'

app/Http/Middleware/RedirectIfAuthenticated.php:24App\Http\Middleware\RedirectIfAuthenticated::handle

 namespace App\Http\Middleware;
 use Closure; 
 use Illuminate\Support\Facades\Auth;

 class RedirectIfAuthenticated {
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Auth::guard($guard)->check()) {
         return redirect('/');
     }

     return $next($request);
 } 
}

I debugged further into code and found out that this function is prolly causing issue.
FILE NAME:Symfony\Component\CssSelector\XPath\Extension\AttributeMatchingExtension

public function translateExists(XPathExpr $xpath, string $attribute, ?string $value): XPathExpr
{
    return $xpath->addCondition($attribute);
}
  • 写回答

1条回答 默认 最新

  • dsyk33753 2018-01-23 10:42
    关注

    I had the same issue with php 7.0.23 and Laravel 5.5 using the php mail() function:

    Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) at [...]/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php:46

    The problem was solved by upgrading to version php 7.1+. (php 7.1.9 in my case)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效