从包含链接的文本文件的每一行中删除换行符并在 iframe 中显示这些链接

$myFile = "text.txt";

$lines = file($myFile);


$link1 = $lines[0];

$link2 = $lines[1];


<!-- 1 -->

<iframe src="<?php echo $link1?>" width="100%" height="50" frameborder="0" scrolling="no">

    your browser do not support iframes.</iframe>


<!-- 2 -->

<iframe src="<?php echo $link2?>" width="100%" height="50" frameborder="0" scrolling="no">

    your browser do not support iframes.</iframe>

这是它在谷歌浏览器视图源中的显示 方式: https ://i.stack.imgur.com/OOzOV.png 这是它在网站上的显示方式,它没有加载: https://i.stack.imgur .com/ziX0f.png


代码有什么问题?


POPMUISE
浏览 108回答 1
1回答

慕雪6442864

将您的行更改为:$lines&nbsp;=&nbsp;file($myFile,&nbsp;FILE_IGNORE_NEW_LINES);使用此标志,将删除每行末尾的新行。
打开App,查看更多内容
随时随地看视频慕课网APP