-1
我工作的非營利組織正試圖從我們定價過高的主機轉移到爲非盈利組織提供免費託管的主機。我的網頁知識很老,並且對html很有限 - 沒有PHP知識。我們當前的主機爲用戶提供了自定義界面,並且不允許我們在public_html文件夾中查看文件或下載它們。index.php?s =不會加載其他內容
根據他們的技術支持,這是不可能與他們的平臺。我已經能夠在新主機站點上重新創建大部分內容,但無法重新創建index.php文件。使用PHP教程我創建了一個新的教程,但它不會加載除歡迎頁面以外的任何內容,我不確定在代碼中我做了什麼錯誤。
我的菜單項是這樣的:
<li class="on">
<a href="http://ourcharity/index.php?s=8077" target="_self"class="on">Welcome</a>
</li>
和我的index.php代碼:
<?php
// create an array with data for title, and meta, for each page
$pgdata = array();
$pgdata['8077'] = array(
'title'=>'WELCOME',
'description'=>'',
'keywords'=>'self-sufficiency'
);
$pgdata['8065'] = array(
'title'=>'About Us',
'description'=>'',
'keywords'=>'self-sufficiency'
);
// set the page name
$pgname = isset($_GET['pg']) ? trim(strip_tags($_GET['pg'])) : '8077';
// get title, and meta data for current /accessed page
$title = $pgdata[$pgname]['title'];
$description = $pgdata[$pgname]['description'];
$keywords = $pgdata[$pgname]['keywords'];
// set header for utf-8 encode
header('Content-type: text/html; charset=utf-8');
?>
<!doctype html>
<html>
<head>
<!-- begin spin_special_output(head_start) -->
<style type="text/css">
.wd_featurebox_icon {
display: inline;
}
.wd_featurebox_icon img {
vertical-align: middle;
}
div.wd_featurebox_group div.wd_tabs_wrapper {
border: none;
border-bottom: 1px solid #E1E1E1;
padding: 0 0 5px 0;
}
div.wd_featurebox_group div.wd_featurebox {
border: none;
padding: 8px 0 0 0;
}
div.wd_featurebox_group li.wd_tab {
float: none;
color: #666666;
}
div.wd_featurebox_group li.wd_tab-active {
border: none;
background-color: transparent;
color: #000000;
font-weight: bold;
}
div.wd_featurebox_group li.wd_tab-inactive {
cursor: auto;
}
</style>
<script type="text/javascript">
function view_printable() {
var loc = window.location;
var sep = (loc.search == "") ? "?" : "&";
var url = loc.protocol+"//"+loc.host+loc.pathname+loc.search+sep+"printable"+loc.hash;
window.open(url, "_blank", "");
}
</script>
<style type="text/css">
span.wd_page_tool {display: inline-block; margin: 0px; padding: 0px; vertical-align: middle;}
div.wd_page_toolbar td span.wd_page_tool {margin: 2px;}
div.wd_page_toolbar td {text-align: center;}
span.wd_page_tool a {display: inline-block; height: 16px; margin: 0px; padding: 0px; vertical-align: middle;}
span.wd_page_tool a span {display: inline-block; margin: 0px; padding: 0px; vertical-align: middle;}
</style>
<!-- end spin_special_output(head_start) -->
<meta charset="utf-8" />
<title><?php echo $title; ?></title>
<meta name="description" content="<?php echo $description; ?>" />
<meta name="keywords" content="<?php echo $keywords; ?>" />
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/wdcontent.css" />
<link rel="image_src" href="images/facebook_logo.jpg" />
</head>
<body>
<div id="headerwrapper" align="center">
<div id="header">
<div id="headerleft">
<div id="headerright">
<div id="logo"><img src="images/logo.jpg" alt="" border="0" /></div>
<div id="headerinner">
<div id="topnav">
<ul>
<li><a href="index.php?s=8088" target="_self">Contact Us</a></li>
</ul>
</div>
<div id="tagbanner">
<img src="file.php/70929/banner.jpg" border="0" />
<div id="tagline">
Self-Sufficiency
<h2></h2><p> </p> </div>
</div>
</div>
<div id="search" align="right">
<div id="searchform">
<!-- BEGIN T1 SEARCH -->
<form method="post" action="index.php?s=8092">
<input class="input" size="15" name="query" value="" />
<input type="submit" class="submit" value="Search" />
</form>
<!-- END T1 SEARCH -->
</div>
</div>
</div><!-- END HEADERRIGHT -->
</div><!-- END HEADERWRAPPERINNERLEFT -->
</div><!-- END HEADER -->
</div><!-- END HEADERWRAPPER -->
<?php echo file_get_contents(''. $pgname. '.htm'); ?>
</body>
</html>
如何使用'$ _GET ['s']'而不是'$ _GET ['pg']'? (在16行上是2) – MiniGod
這是問題所在。非常感謝你!我已經瀏覽了很多小時的代碼,並沒有進行關聯,但現在它變得非常有意義。 – user3103472
如果你想讓你的數據發送出現在鏈接中,只需使用GET表單類型 – Anas