【问题标题】:Laravel 6.0 input::value"old(' ')"Laravel 6.0 输入::value"old(' ')"
【发布时间】:2020-09-13 03:04:59
【问题描述】:

我正在使用此代码,但我没有使用旧功能 我已经使用了这两个<?php echo old('title'); ?>{{ old('title') }} 两者都不起作用

 <form action="<?php echo route('post.create') ?>" method="GET">
 @csrf
        <input type="text" name="title" value="<?php echo old('title');  ?>"></br>
        <textarea name="contant" id="" cols="30" rows="10"><?php echo old('contant'); ?></textarea>

【问题讨论】:

  • 欢迎来到 SO ... post.create 路由是否通过输入重定向回来?

标签: laravel laravel-6


【解决方案1】:

更改为post

method="POST"

【讨论】:

    【解决方案2】:

    如果您想使用 GET 方法,请使用请求帮助函数而不是旧的。

    如果您使用 POST 方法但仍然无法正常工作。解决方案很少。

    使用withInput()返回数据

    return back()->withInput()->withErrors('Add atleast one image in the post.');
    

    Stack Overflow Ref

    不知道你是否记得,但前几天我提出了一个线程,我在使用 Chrome 时遇到了缓存问题。这可能是有道理的。我尝试了 Canary 和同样的问题,所以也许它是 chrome(如果那是 OP 正在使用的)请看这篇文章。 Laracasts Ref

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-28
      • 2013-09-21
      • 1970-01-01
      • 2021-01-21
      • 1970-01-01
      • 2014-11-21
      • 2020-07-30
      • 1970-01-01
      相关资源
      最近更新 更多