很好地工作,我想從這種的URL得到一個iframe:http://mydomain.com/frame.php?q=http://someotherdomain.comPHP會因某些原因無法
出於某種原因,我得到一個服務器錯誤與此代碼並不能找出原因。有沒有人看到錯誤?
謝謝!
<?php
$q = $_GET('q');
function getTitle($Url){
$str = file_get_contents($Url);
if(strlen($str)>0){
preg_match("/\<title\>(.*)\<\/title\>/",$str,$title);
return $title[1];
}
};
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo getTitle($q) ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<?php echo "<iframe src='".$q."' style='width:100%;height:100%;border:0;'></iframe>" ?>
</body>
</html>
有什麼錯誤訊息? – Teekin