【问题标题】:a page in a page without iframe没有 iframe 的页面中的页面
【发布时间】:2014-02-08 21:29:08
【问题描述】:

我正在尝试找到一种方法,如何在没有 iframe 的情况下将页面放入另一个页面并包含页眉和页脚。我尝试了 iframe,但我不喜欢它。这就是布局的样子, 我在这个文件中做了一个页面调用 help.php 我在下面包含以下代码

<?php include("connection.php"); include("header.php"); ?>
  <div class="container">
( i want to put this url here support.sitename.com )
</div>
<?php include("footer.php") ?> 

应该是这样的 sitename.com/help.php 我有另一个页面 support.sitename.com(这个页面正在使用帮助台软件调用 HESK

我正在尝试将 support.sitename.com 添加到 sitename.com/help.php 但我不想使用 iframe 我该怎么做

【问题讨论】:

标签: php html iframe


【解决方案1】:
<?php include("connection.php"); include("header.php"); ?>
  <div class="container">
<?php 
$html =  file_get_contents("http://support.sitename.com"); 
$html = preg_replace('%href="/(.*?)"%si', 'href="http://support.sitename.com/$1"', $html);
echo $html;
?>
</div>
<?php include("footer.php") ?> 

【讨论】:

  • 谢谢你的代码,但是当我点击页面内的链接时,它会打开一个新页面到我的主页
  • 这是因为链接是相对的而不是绝对的,使用正则表达式来更改链接(compugoddess.com/relative-vs-absolute-links
  • 对不起,我是新手,别生气,你的意思是这样的&lt;?php echo file_get_contents("http://support.sitename.com/(?&lt;=href=(\"|'))[^\"']+(?=(\"|'))/"; ?&gt;
猜你喜欢
  • 2010-09-08
  • 2021-09-02
  • 2012-01-16
  • 1970-01-01
  • 1970-01-01
  • 2017-07-26
  • 1970-01-01
  • 2021-10-17
  • 2015-09-14
相关资源
最近更新 更多