以下脚本并不总是能正确捕捉和转换外来字符。有人可以告诉我我缺少什么以使其更强大吗?
<?php
include("../index_head.inc.php");
$content = implode("",(@file("current.txt")));
$url = "http://XXXXXX.html?no_body=1";
$content = file_get_contents($url,'r');
if (isset($_GET['showcurrent']) && $_GET['showcurrent'] == '')
{
$content = substr($content,1,strpos($content,"<hr ")-1);
}
else
{
$content = str_replace("<br style=\"clear:both\" />\n</p>", "</p>",$content);
$content = str_replace("ck1\"><img", "ck1\" target=_blank><img",$content);
};
$content = str_replace("<h3>current</h3>", "",$content);
echo "<div id=\"service\" style=\"width: 660px;padding-left:5px\">",str_replace("current.html","current.html",$content),"</div>";
include("../index_footer.inc.php");
?>
新信息:Pekka,你给了我在没有 str_replace() 的情况下检查页面如何发出的想法:
<?php
include("../index_head.inc.php");
$content = implode("",(@file("current.txt")));
$url = "XXXXXX.html?no_body=1";
$content = file_get_contents($url,'r');
echo "<div id=\"service\" style=\"width: 660px;padding-left:5px\">",$content,"</div>";
似乎问题出在其他地方,因为即使不使用 str_replace(),我也会得到相同的修饰!如果您能帮我解决这个问题,我将不胜感激。我看过你的愿望清单。;)