laravel 5.3 如何在 blade 模板中获取 id
How to fetch id in blade template in laravel 5.3
我想在 blade 中获取这个 id 9
http://localhost/connect/public/index.php/profile/9
我不想路由它
在你的配置文件控制器中你的方法是这样的
public function profile($profile){
// you can call model function and get data from profile id
//and then pass it to the view
$data["profile_info"] = "fetch the data from database call your model function ";
return View("your_bladefilename",$data);
}
您可以使用 profile_info 变量
在 blade 文件中访问 profile_info
在您的 blade 文件中
<?php
print_r($profile_info);
?>
如果有任何不清楚的地方,请告诉我
我想在 blade 中获取这个 id 9 http://localhost/connect/public/index.php/profile/9 我不想路由它
在你的配置文件控制器中你的方法是这样的
public function profile($profile){
// you can call model function and get data from profile id
//and then pass it to the view
$data["profile_info"] = "fetch the data from database call your model function ";
return View("your_bladefilename",$data);
}
您可以使用 profile_info 变量
在 blade 文件中访问 profile_info在您的 blade 文件中
<?php
print_r($profile_info);
?>
如果有任何不清楚的地方,请告诉我