我使用curl函数将外部html文件拉入php页面,如下所示。是否有一种方法可以更改此选项以使文件被拉入以响应收缩并在移动设备上查看时增大,以便整个内容在宽度中可见。此刻它会切断每一行并转到下一行。
<pre> <span class="inner-pre" style="font-size: 11px font-family:sans-serif"><?php
function curl_download($Url){
if (!function_exists('curl_init')){
die('cURL is not installed. Install and try again.');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
$start = strpos($output, '<pre>');
$end = strpos($output, '</pre>', $start);
$length = $end-$start;
$output = substr($output, $start, $length);
curl_close($ch);
return $output;
}
$str = curl_download('http://www.atletiek.co.za/atletiek.co.za/uitslae/2016BolandJuniors/160226P227.htm');
$re = "/([^\n\r]+)/m";
preg_match_all($re, $str, $matches);
$matches = $matches[1];
$str = "";
for($i = 5; $i <= 50; $i++) {
$str .= $matches[$i] . "<br>"; // Preserve the new line
}
echo $str;
?></pre>