我工作的非营利组织正试图从我们价格过高的主机转移到为非营利组织提供免费托管的主机。我的网页知识很老,而且对html很有限 - 没有PHP的知识。我们当前的主机为用户提供了自定义界面,不允许我们查看public_html文件夹中的文件或下载它们。
根据他们的技术支持,他们的平台无法实现这一点。我已经能够在新主机站点上重新创建大部分内容,但无法重新创建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>
答案 0 :(得分:0)
使用$_GET['s']
代替$_GET['pg']
。 (第16行2x)