- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想将数据保存在我的数据库中,但在存储数据后我的输出出现错误,有人可以帮助我吗我正在尝试保存数据而不是输出一些错误但她在保存数据后发送错误说 preg_replace 我该怎么做才能停止它并重定向到其他路由
这是我的 Controller
public function create()
{
return view('employmentform');
}
public function handleCreate(Request $request)
{
$employe = employe::create([
'fname' => $request->input('first_name'),
'lname' => $request->input('last_name'),
'phone' => $request->input('phone_number'),
'email' => $request->input('email'),
'houseno' => $request->input('house'),
'kebele' => $request->input('kebele'),
'city' => $request->input('city'),
'state' => $request->input('state'),
'age' => $request->input('date'),
'username' => $request->input('user_name'),
'sex' => $request->input('sex'),
'password' => Hash::make($request->input('country')),
'salary' => $request->input('salary'),
'bankaccount' => $request->input('account'),
'bankname' => $request->input('bank'),
'employedate' => getdate(),
'contactid'=> 1,
]);
return Redirect::action('ContactController@create');;
}
她是我的表单 View
<form action="{{ action('EmployeController@handleCreate') }}" method="post" role="form">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<label for="first_name" id="first_name" >first name</label>
<input name="first_name" type="text" id="first_name" class="form-control"></br>
<label for="last_name" id="last_name">last name</label>
<input name="last_name" type="text" id="last_name" class="form-control"></br>
<label for="date" id="date">day of birth</label>
<input name="date" type="date" id="date" class="form-control"></br>
<input type="radio" name="sex" value="Male"/>Male
<input type="radio" name="sex" value="Female"/>Female</br>
<label for="phone_number" id="phone_number">phone_number</label>
<input name="phone_number" type="text" id="phone_number" class="form-control"></br>
<label for="email" id="email">email</label>
<input name="email" type="email" id="email" class="form-control"></br>
<label for="house" id="house">house_number</label>
<input name="house" type="text" id="house" class="form-control"></br>
<label for="kebele" id="kebele">kebele</label>
<input name="kebele" type="text" id="kebele" class="form-control"></br>
<label for="city" id="city">city</label>
<input name="city" type="text" id="city" class="form-control"></br>
<label for="state" id="state">state</label>
<input name="state" type="text" id="state" class="form-control"></br>
<label for="user_name" id="user_name">user_name</label>
<input name="user_name" type="text" id="user_name" class="form-control"></br>
<label for="password" id="password">password</label>
<input name="password" type="password" id="password" class="form-control"></br>
<label >re-password</label>
<input name="password_confirmation"type="password" class="form-control"></br>
<label for="work" id="work">work position</label>
<input name="work" type="text" id="work" class="form-control"></br>
<label for="salary" id="salary">salary</label>
<input name="salary" type="text" id="salary" class="form-control"></br>
<label for="account" id="account">bank account number</label>
<input name="account" type="text" id="account" class="form-control"></br>
<label for="bank" id="bank">bank name</label>
<input name="bank" type="text" id="bank" class="form-control"></br>
<input type="submit" value="Create" class="btn btn-primary" />
</form>
将数据存储到数据库中,但发送错误
ErrorException in helpers.php line 686:
preg_replace(): Parameter mismatch, pattern is a string while replacement is an array
在这里输入代码
最佳答案
我有一个类似的错误,结果证明是由于我的 POST 数据中有一个 2 级以上的嵌套数组(不是 JSON 序列化)引起的。
如果您的 POST 请求的 header 中有这样的模式(使用 Chrome 的检查器查看),那么您遇到了同样的问题,您需要删除或序列化数组的内容( data[pivot]
在我的例子中):
_method:PUT
data[id]:6
data[site_id]:1
data[name]:sdafasfvdsfdsfg
data[url]:
data[created_at]:2015-09-04 12:51:54
data[updated_at]:2015-09-04 12:51:54
data[pic]:
data[original_pic]:
// ! This was the problem:
data[pivot][quiz_id]:1
data[pivot][product_id]:6
希望对您有所帮助!
附言。对于阅读本文的任何核心 Laravel 开发人员:请找到一种方法来改进一般的错误报告,有些错误真的是“WTF”,如果不试错几乎不可能追踪。
关于php - laravel preg_replace() : Parameter mismatch, 模式是一个字符串,而替换是一个数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30278223/
equal() 算法可以告诉我们两个序列是否匹配。mismatch() 算法也可以告诉我们两个序列是否匹配,而且如果不匹配,它还能告诉我们不匹配的位置。 mismatch() 的 4 个版本和 equ
我只是想在 emacs 中自定义一些 org-mode 导出设置,所以我做了 M-xcustomize-group组织导出 html。这是由 Customize buffer 提出的,除其他外,我着手
我正在尝试通过 ColdFusion 使用基于 HTTPS 的 SOAP WebService,但它返回“连接失败”。 在转储结果变量时,它显示: 错误详细信息:“I/O 异常:证书‘subdomai
我想匹配表单的输入:: commit a1b2c3 Author: Michael commit d3g4 Author: David 这是我写的语法: grammar commit; file
我正在尝试根据《Doing Bayesian Data Analysis: A Tutorial with R, JAGS, and Stan (2015)》一书来学习贝叶斯分析。 这本书里有例子。所
我有一些使用 java 泛型的类,一切都工作正常,直到我向类层次结构添加了一些附加层。 我想知道问题是否与“类型删除”有关,但我不确定如何表达继承来消除这个问题。 类定义: public interf
我正在尝试向我的应用程序添加一种语言,它一直运行到现在。经过一天尝试了解发生了什么,我放弃了。 这是我的问题: 我的基本语言是英语(开发语言),我的其他语言是法语。我在 Main.storyboard
我最近开始在 Go 中使用模块,但我经常遇到这样的问题,即在一台机器上一切正常,但在另一台机器上构建代码库时遇到校验和不匹配。 问题总是涉及相同的第三方依赖(github.com/ericlagerg
今天在用织梦系统搭建新站,在系统基本参数设置好了之后,像往常那样点击【确定】这个按钮,没想到却出现了Token mismatch!的提示,系统的基本参数无法改变,后经过查询,将出现Token mis
题目地址:https://leetcode.com/problems/set-mismatch/description/open in new window 题目描述 Theset S origi
在看似简单的任务上陷入了极大的困境...当我尝试隐藏 时出现类型不匹配错误多个 使用此代码的列.. 有什么更好的建议吗? 问候, Sub Hider() Sheets("Data So
大家好,我收到一个编译错误:类型不匹配。在下面的代码中。我希望你们能帮助我。谢谢! Private Sub cmbBusId_AfterUpdate() With Me .txtStOdo = App
我最近遇到了一条我从未见过的借用检查器消息,我试图理解它。这是重现它的代码(简化的,现实生活中的例子更复杂)- playground : fn foo(v1: &mut Vec, v2: &mut V
我尝试编写代码以打印Z字符。 zzzzzzz z z z z z zzzzzzz 但是当我编译这段代码时,它会抛出 D:\erlang\graphics>erlc zee
Sub Reset_Bet() Application.ScreenUpdating = False Sheets("Bet Angel").Select
我很难弄清楚这段应该是基本的代码片段出了什么问题。我想知道是否有人可以帮助我。任何想法都将非常感激,我对 VBA 还很陌生。 我的代码是: Dim table() as Variant: ta
我只是想从键盘读取整数、 double 、字符串值。它对于整数和 double 工作正常。但当涉及到字符串时,它会抛出输入不匹配异常,因此我无法从键盘读取字符串。 import java.util.S
给定一个学生花名册文件,其中第一行是类(class)中的学生人数,在接下来的几行中,我提供了他们的姓名、ID 和年龄,如下所示: 5 Mary, 1010, 15 Ben, 1
Android资源编译失败C:\Users\TTP\AndroidStudioProjects\TicCrossGame\app\src\main\res\layout\activity_main.x
found : (Int, String, Option[java.lang.String]) required: (Int, String, Option[java.lang.String])
我是一名优秀的程序员,十分优秀!