php - How to get a variable value file from laravel blade
问题描述
I have a hidden field in laravel blade.
<input type="hidden" name="agencyid" value="{{Auth::user()->agency_id}}" />
How will i get the value of this variable "agencyid" and assign to another variable? Like
$agency=$agencyid;
Iam trying to pass this value to an external PHP file.
<?php include($_SERVER['DOCUMENT_ROOT'].'/core/agency_expiry.php?agency=$agency'); ?>
Iam new to laravel so exploring the same.
解决方案
You can use this library: https://github.com/ixudra/curl
use Ixudra\Curl\Facades\Curl;
public function externalLink(Request $request) {
$agency = $request['agencyid'];
$url = Curl::to( __DIR__..'/core/agency_expiry.php?agency='.$agency)->get();
//now play with the return value
dd($url);
}
推荐阅读
- c++ - 如何使用文件填充结构(下面附上代码)?
- javascript - 网站仅在重新加载后更改 - 反应路由器
- php - PHP / ORACLE 获取当前登录用户的用户名
- c - 为什么两个程序中的变量分配方式相同?
- python - 遍历 DataFrame 并将步骤号分配给具有相同 ID 的行
- c++ - 如何在 C 或 C++ 中包装参数并将它们传递给 system 或 exec*
- php - How to define services and access it in controller?
- mongodb - 如何更新具有多级数组和对象的 Mongdb 文档
- ruby - 我可以从另一个类中的方法实例化一个类吗?(红宝石)
- c# - c#子类构造函数是不是必须要写?