Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.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
如何使用laravel根据表单输入值提交表单后获取数据_Laravel_Laravel 5_Laravel 4_Laravel 5.2 - Fatal编程技术网

如何使用laravel根据表单输入值提交表单后获取数据

如何使用laravel根据表单输入值提交表单后获取数据,laravel,laravel-5,laravel-4,laravel-5.2,Laravel,Laravel 5,Laravel 4,Laravel 5.2,我的控制器包含一个函数,当我将控制器函数返回到视图时,会调用多个API自动显示API数据,但我需要在提交表单时显示数据。请提出解决方案 我的控制器代码 public function domaincheck(Request $request) { ini_set('max_execution_time', 300); <!-- Domain Availability Check --> $sld = $request['sld']; $tld = $request['

我的控制器包含一个函数,当我将控制器函数返回到视图时,会调用多个API自动显示API数据,但我需要在提交表单时显示数据。请提出解决方案

我的控制器代码

public function domaincheck(Request $request)
{
ini_set('max_execution_time', 300);
<!-- Domain Availability Check -->
    $sld = $request['sld'];
    $tld = $request['tld'];
    $response = file_get_contents('https://resellertest.enom.com/interface.asp?command=check&sld='. $sld .'&tld='. $tld .'&uid=resellid&pw=resellpw&responsetype=xml');  
    $data = simplexml_load_string($response);
    $configdata   = json_encode($data);
    $final_data = json_decode($configdata,true);

 <!--Domain Name Suggestions --> 
  $response1 = file_get_contents('http://resellertest.enom.com/interface.asp?command=GETNAMESUGGESTIONS&uid=resellid&pw=resellpw&SearchTerm='. $sld .'&MaxResults=5&ResponseType=XML');       
    $data1 = simplexml_load_string($response1);
    $configdata1   = json_encode($data1);
    $final_data1 = json_decode($configdata1,true);
}
公共功能域检查(请求$Request)
{
ini设置(“最大执行时间”,300);
$sld=$request['sld'];
$tld=$request['tld'];
$response=file\u get\u contents($response)https://resellertest.enom.com/interface.asp?command=check&sld=“.$sld.&tld=”.$tld.&uid=relailId&pw=relailpw&responsetype=xml”);
$data=simplexml\u load\u字符串($response);
$configdata=json_encode($data);
$final_data=json_decode($configdata,true);
$response1=文件\u获取\u内容('http://resellertest.enom.com/interface.asp?command=GETNAMESUGGESTIONS&uid=resellid&pw=resellpw&SearchTerm=“.$sld.”&MaxResults=5&ResponseType=XML');
$data1=simplexml\u load\u字符串($response1);
$configdata1=json_encode($data1);
$final_data1=json_decode($configdata1,true);
}
我的视图代码

 <form class="form-horizontal" method="get"> 
  <div class="form-group">
     <div class=" col-lg-2"></div>
     <div class="col-lg-8">
         <div class="input-group m-b">
            <span class="input-group-addon" style="padding-left:10px; background-color: #999;" class='unclickable'>www</span>
            <input type="text" name="sld" class="form-control">
  <span class="input-group-addon">
  <select class="form-control" name="tld" style="width: 100px;">
 <?php $j = 0; ?>
  @foreach($final_data2['tldlist']['tld'] as $value)
  <?php $j++; ?> 
  @endforeach
  @for ($i = 0; $i < $j-1;)
  <option value="{{($final_data2['tldlist']['tld'][$i]['tld'])}}">{{($final_data2['tldlist']['tld'][$i]['tld'])}}</option>
  <?php $i++; ?> 
  @endfor
      </select>  
      </span>
      <span class="input-group-addon">
      <button type="submit" class="btn btn-sm btn-success">Submit</button>  
      </span>
      </div>
                <p class="text-center text-dark customFont" >
                    @foreach($final_data as $key=>$value)
                      @if($key=='DomainName')
                        <b>{{$value}}</b> <b>-</b>
                      @endif 
                      @if($key=='RRPText')
                          <b>{{$value}}</b>
                      @endif
                    @endforeach
                </p>

        {{print_r($final_data1)}} 

万维网
@foreach($value形式的最终数据2['tldlist']['tld']
@endforeach
@对于($i=0;$i<$j-1;)
{($final_data2['tldlist']['tld'][$i]['tld']])}
@结束
提交

@foreach($key=>$value形式的最终数据) @如果($key=='DomainName') {{$value}}- @恩迪夫 @如果($key=='RRPText') {{$value}} @恩迪夫 @endforeach

{{打印(最终数据1)}

提交表单(响应)时,会显示域名是否可用。Response1显示域名建议,但显示数据时未提交表单。请建议任何解决方案

自动显示my view api数据
,您可能已将keyup事件绑定到该输入,它向
domaincheck
my输入绑定到response1,并显示确切的输出。但唯一的问题是在没有表单提交的情况下显示响应数据。提交表单后需要显示数据。