Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.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
Php 我需要把pre标签的滚动条放在内容行中_Php_Html - Fatal编程技术网

Php 我需要把pre标签的滚动条放在内容行中

Php 我需要把pre标签的滚动条放在内容行中,php,html,Php,Html,我有上千行的文本文件,我想制作一个php页面,在那里我可以看到它们,并在我想要的地方打开它。我的意思是,滚动条必须在我想要的行中。文件在pre标记上完全打开,但滚动条必须在“N”行中 这将使用php打开文件: echo "<pre >"; $file = $pathOfFile; $contents = file_get_contents($file); $lines = explode("<br>", $contents); // this is your ar

我有上千行的文本文件,我想制作一个php页面,在那里我可以看到它们,并在我想要的地方打开它。我的意思是,滚动条必须在我想要的行中。文件在pre标记上完全打开,但滚动条必须在“N”行中

这将使用php打开文件:

 echo "<pre >";
 $file = $pathOfFile;
 $contents = file_get_contents($file);
 $lines = explode("<br>", $contents); // this is your array of words

 foreach($lines as $word)
        echo $word; 

 echo"</pre>";
<pre>
    <a name="0"></a>Line 1<br>
    <a name="1"></a>Line 2<br>
    <a name="2"></a>Line 3</br>
    ...
    <a name="500"></a>Line 500
</pre>
echo”“;
$file=$pathOfFile;
$contents=file\u get\u contents($file);
$lines=分解(“
”,$contents);//这是你的单词数组 foreach($word形式的行) 回声$字; 回声“;
我的建议是在每个条目前面加上锚定标签:

echo '<pr>';
$file = $pathOfFile;
$contents = $file_get_contents($file);
$lines = explode('<br>', $contents);

$i = 0;
foreach($lines as $word)
{
    echo '<a name="' . $i . '"></a>' . $word . '<br>';
    ++$i;
}

echo '</pre>';
echo';
$file=$pathOfFile;
$contents=$file\u get\u contents($file);
$lines=分解(“
”,$contents); $i=0; foreach($word形式的行) { 回声'