doulin1867 2017-10-22 21:47
浏览 914
已采纳

Laravel:从控制器重定向到特定的URL

I'm having troubles to just redirect to a url from a controller.

This is my trigger:

<form method="POST" action="{{ url('creategroup") }}">

Then, this is the catcher:

Route::post('/creategroup', 'GroupController@store');

And finally, this is my method:

public function store(Request $request) {
    /* bla bla bla */
    return Redirect::to('/users/'.$request->id.'/groups/');
}

But it doesn't work, the url just stops in localhost/creategroup and it shows a page that say that the page has expired, and it doesn't redirect to any place. Help please.

  • 写回答

2条回答 默认 最新

  • douyu0725 2017-10-22 22:08
    关注

    Looks like a problem with csrfToken.

    Have you added the field on the form?

    {!! csrf_field() !!}
    

    Learn more here

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 有偿求效果比较好的遥感影像匹配的c++代码
  • ¥15 博主,你好,我下载了你的智能网联汽车辅助驾驶安全信息检测系统,现在不会运行,可以教我吗,
  • ¥15 怎么在excle输入下列公式
  • ¥15 Arduino,利用modbus的RS485协议,进行对外置的温湿度传感器进行数据读取
  • ¥15 vhdl+MODELSIM
  • ¥20 simulink中怎么使用solve函数?
  • ¥30 dspbuilder中使用signalcompiler时报错Error during compilation: Fitter failed,求解决办法
  • ¥15 gwas 分析-数据质控之过滤稀有突变中出现的问题
  • ¥15 没有注册类 (异常来自 HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  • ¥15 知识蒸馏实战博客问题