我在控制器中有这个动作
public function upload() {
// getting all of the post data
$file = array('image' => Input::file('image'));
//return $file;
// setting up rules
$rules = array('image' => 'required'); //mimes:jpeg,bmp,png and for max size max:10000
// doing the validation, passing post data, rules and the messages
$validator = Validator::make($file, $rules);
if ($validator->fails()) {
// send back to the page with the input data and errors
// return Redirect::to('upload')->withInput()->withErrors($validator);
return "error validation";
}
else {
// checking file is valid.
if (Input::file('image')->isValid()) …Run Code Online (Sandbox Code Playgroud) 当我运行这个程序时,它会产生错误[Error] call of overloaded 'add(double, double, double)' is ambiguous.
这是为什么?我的意思是函数参数有不同的数据类型,它实际上是函数重载,那么为什么错误呢?
但是当float被double替换时,它工作正常.
#include<iostream>
using namespace std;
void add(){
cout<<"I am parameterless and return nothing";
}
int add( int a, int b ){
int z = a+b;
return z;
}
int add(int a, int b, int c){
int z = a+b+c;
return z;
}
int add(float a, float b, float c)
{
int z = a +b + c;
return z;
}
int main()
{
cout<<"The void add() function -> …Run Code Online (Sandbox Code Playgroud) 我在控制器中有这个功能.
public function newsedit($id)
{
$editNews = $this->agro->find($id);
//return $editNews;
return Redirect::back()->with('editNews',$editNews);
//return View::make('agro.show')->with('editNews',$editNews);
}
Run Code Online (Sandbox Code Playgroud)
返回$ editNews显示数据,因此$ editNews.Now中有数据我试图使用重定向将相同的数据传递给视图,如上面的代码所示.但显然价值没有通过.以下代码显示视图中的值不可用
@if(isset($editNews))
<h1> value availabel</h1>
@else
<h1> No value </h1>
@endif
Run Code Online (Sandbox Code Playgroud)
它显示无值.请帮我传递数据来查看.我不明白我哪里出错了.