首页 > 解决方案 > 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.

标签: phpmysqllaravel

解决方案


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);
}

推荐阅读