Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在url中获取id并将其显示在表单laravel 5中_Php_Laravel 5 - Fatal编程技术网

Php 如何在url中获取id并将其显示在表单laravel 5中

Php 如何在url中获取id并将其显示在表单laravel 5中,php,laravel-5,Php,Laravel 5,我有一个href,它引导您访问addeditvisit/(所选行的id) 在我的表单中,我首先输入文本,而不是隐藏文本,以显示真正的值,并显示它 addeditvisit/5 我真正想要的是只得到5分。我应该使用什么功能?请帮帮我,我刚刚进入Laravel 5,仍在学习如果您愿意,您可以传递整个患者对象,如下所示: $patient = Patient::find($id); // get it from db, or some other data source return View

我有一个href,它引导您访问addeditvisit/(所选行的id)

在我的表单中,我首先输入文本,而不是隐藏文本,以显示真正的值,并显示它

addeditvisit/5

我真正想要的是只得到5分。我应该使用什么功能?请帮帮我,我刚刚进入Laravel 5,仍在学习

如果您愿意,您可以传递整个患者对象,如下所示:

$patient = Patient::find($id);  // get it from db, or some other data source  
return View::make('pages.addeditvisit', ['uri'=>$uri, 'patient' => $patient]);
` 然后在你的表格中,你可以使用

$patient->pID
或者,如果您只想获得以下信息,您可以传递id本身:

return View::make('pages.addeditvisit', ['uri'=>$uri, 'pID' => $patient->pID]);

如果需要,可以传递整个患者对象,如下所示:

$patient = Patient::find($id);  // get it from db, or some other data source  
return View::make('pages.addeditvisit', ['uri'=>$uri, 'patient' => $patient]);
` 然后在你的表格中,你可以使用

$patient->pID
或者,如果您只想获得以下信息,您可以传递id本身:

return View::make('pages.addeditvisit', ['uri'=>$uri, 'pID' => $patient->pID]);