php - laravel 5.7中返回变量的问题
问题描述
我使用 Laravel 5.7。程序运行时网站可见,但完成后(返回功能)不会显示页面中的所有网站。我认为回归剧集的问题,但我无法解决。
功能
public function sls(Request $request){
$ip = $request->input('ip');
$cnt=1;
$count=0;
ini_set('max_execution_time', 600);
$nextpage=true;
while($nextpage==true){
if($cnt==1)
$url="https://www.bing.com/search?q=ip%3A".$ip."&qs=n&form=QBRE&pq=ip%3A".$ip."&sc=0-0&sp=-1&sk=";
else
$url="https://www.bing.com/search?q=ip%3a".$ip."&qs=n&sp=-1&pq=ip%3a".$ip."&sc=0-15&sk=&cvid=75D6BFCE5DF344E083DF2C10D5B735E9&first=".$cnt."&FORM=PERE";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
$result=curl_exec($ch);
$myPattern = "#<cite>(.*?)</cite>#" ;
if(preg_match_all($myPattern,$result,$find)){
$urls = preg_replace("/<\/?strong>/","",$find[1]);
$keys = array_filter($urls);
$html = '<ul>';
foreach($keys as $value){
$count += 1;
$html .= '<li> '.$count.'.'.$value.' </li>';
}
$html .= '</ul>';
echo $html;
}
if(preg_match('/class="sb_pagN sb_pagN_bp b_widePag sb_bp "/',$result))
$cnt+=40;
else
$nextpage=false;
}
return back()->with('list', $html);
形式
<form action = "" method = "post">
<input type = "hidden" name = "_token" value = "<?php echo csrf_token() ?>">
<table>
<tr>
<td>Server list site: </td>
<td><input type="text" name="ip" /></td>
</tr>
</table>
{!!会话(“列表”)!!}
解决方案
程序运行时网站可见,但完成后(返回功能)不会显示页面中的所有网站。
我认为您需要echo $html;
从控制器sls()
方法中删除该行:
if(preg_match_all($myPattern,$result,$find)){
$urls = preg_replace("/<\/?strong>/","",$find[1]);
$keys = array_filter($urls);
$html = '<ul>';
foreach($keys as $value){
$count += 1;
$html .= '<li> '.$count.'.'.$value.' </li>';
}
$html .= '</ul>';
echo $html; // <------- Remove this line.
}
推荐阅读
- html - 清晰属性 CSS[style="clear:both;" ]
- python - Python DistributionNotFound 问题
- javascript - location.href 刷新而不是重定向
- html - 在 css 中加载的字体没有显示在网站上
- netlogo - 当我的海龟品种开始更快地移动并限制海龟可以长到多大时,设置能量下降
- jetty - Jetty 的 DDOS 防护
- python - Django 打开渲染的 HTML 文件
- c++ - 如何测试是否存在两个文件中的任何一个?
- amazon-web-services - RDS - 禁用备份的自动快照?
- javascript - 单击一个按钮以显示更多信息,然后单击它以显示更少的信息