【发布时间】:2015-08-26 12:00:59
【问题描述】:
我正在从一本书中学习 PHP,我从书本网站复制了以下代码。当我在 Zend Studio 中运行它并选择任何超链接(例如 Home)时,显示的只是 php 文件的名称。例如 index.php。它不会链接到并执行 php 文件。这是为什么呢?
任何帮助将不胜感激,谢谢。
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class Registration Template</title>
<link rel= "stylesheet" type= "text/css" href= "C:\Users\trevor.reeves\Documents\PHP&mySQLBook\php-mysql-abg-listings-1\ClassRegistration_Public/registration.css"/>
<script type= "text/javascript"></script>
</head>
<body>
<div id="wrapper">
<div id="header">
<img src="C:\Users\trevor.reeves\Documents\PHP&mySQLBook\php-mysql-abg-listings-1\ClassRegistration_Public/MatTechLogo.gif" alt="Matthews Technology" />
<h1 id="title">Class Selection and Registration</h1>
</div> <!-- id="header" -->
<div id="hnav">
<table width="400" border="0" cellspacing="2" cellpadding="2">
<tr>
<td><a class="hmenu" href="index.php">Home</a> </td>
<td><a href="index.php">About</a> </td>
<td><a href="index.php">Support</a> </td>
<td><a href="/AdministratorAuthentication/adminAuthen.php">Maintain</a> </td>
</tr>
</table>
</div> <!-- id="hnav" -->
<div id="vnav">
<table width="120" border="0" cellspacing="2" cellpadding="2">
<tr>
<td id="vhead">Go To: </td>
</tr>
<tr>
<td><a href="classlist.php">Class List</a> </td>
</tr>
<tr>
<td><a href="nameentry.php">Student Entry</a>
</td>
</tr>
</table>
</div> <!-- id="vnav" -->
<div id="main">
<h1 id="maintitle">Spring Class Schedule</h1>
<p id="mainpara">Click Register to do so for a class.</p>
<p class="red">*A footnote.</p>
</div> <!-- id="main" -->
<div id="footer">
<p id="copyright">
Copyright ©:2008 -
<?php
date_default_timezone_set('America/Vancouver');
echo date('Y');
?>
Matthews Technology
</p>
<p id="contact">
<a href="mailto:info@matthewstechnology.com">Contact us by clicking here.</a>
</p>
</div> <!-- id="footer" -->
</div> <!-- id="wrapper" -->
<?php
;
?>
</body>
</html>
【问题讨论】:
-
您是否安装了XAMPP或WAMPP进行php渲染。
-
为什么链接引用指向本地驱动器中的绝对路径? stylesheet 和 img 引用应该指向相对路径或 http(s) 路径
-
小贴士:如果你想学习,千万不要复制代码,而是输入代码。
-
我不明白这个问题。你能强调一下吗?
-
CodeGodie:当我执行列出的名为 template.php 的代码并单击超链接 Home 或 Maintain 时,Zend 不会执行那些 php 文件。它只是显示文件的名称而不做其他任何事情。